Esempio n. 1
0
        public static void RegisterSurrogateForXmlNode()
        {
            string signature = SurrogatesDirectory.ValidSignature("XMLNODE");

            SurrogatesDirectory.RegisterSurrogate(signature: signature, supportedType: typeof(System.Xml.XmlNode),
                                                  calculateDependencies: new SurrogateDependencyCalculation[] { CalculateXmlNodeDependencies },
                                                  serializeEx: SerializeXmlNode,
                                                  deserializeEx: DeSerializeXmlNode);
        }
        public static void RegisterSurrogate()
        {
            string signature = SurrogatesDirectory.ValidSignature("SLIST");

            SurrogatesDirectory.RegisterSurrogate(
                signature: signature,
                supportedType: typeof(System.Collections.SortedList),
                applyBindingAction: null,
                serializeEx: Serialize,
                deserializeEx: Deserialize);
        }
Esempio n. 3
0
        private static void RegisterSurrogateForAdoRecordSetHelper()
        {
            string signatureAdoRecordSetHelper = SurrogatesDirectory.ValidSignature("ADORS");

            SurrogatesDirectory.RegisterSurrogate(signatureAdoRecordSetHelper, typeof(ADORecordSetHelper),
                                                  serializeEx: Serialize,
                                                  deserializeEx: Deserialize,
                                                  applyBindingAction: ApplyBindingAction,
                                                  calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDependencies },
                                                  PropertyGetter: PropertyGetter,
                                                  PropertySetter: PropertySetter);
        }
Esempio n. 4
0
        public static void RegisterSurrogateForDataRow()
        {
            signature = SurrogatesDirectory.ValidSignature("DROW");
            SurrogatesDirectory.RegisterSurrogate(

                signature: signature,
                supportedType: typeof(System.Data.DataRow),
                applyBindingAction: null,
                serializeEx: SerializeDataRow,
                deserializeEx: DeserializeDataRow,
                calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDataTableDependency }
                );
        }
Esempio n. 5
0
        public static void RegisterSurrogateForDataRowView()
        {
            constructorDataViewRow = typeof(DataRowView).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(DataView), typeof(DataRow) }, null);

            string signature = SurrogatesDirectory.ValidSignature("DRVIEW");

            SurrogatesDirectory.RegisterSurrogate(

                signature: signature, supportedType: typeof(System.Data.DataRowView),
                serializeEx: SerializeDataRowView,
                deserializeEx: DeserializeDataRowView,
                calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDataRowViewDependencies });
        }
Esempio n. 6
0
        public static void RegisterSurrogateForDataset()
        {
            Debug.WriteLine("Registering surrogate for DATASET");
            string signatureDataSet = SurrogatesDirectory.ValidSignature("DATASET");

            SurrogatesDirectory.RegisterSurrogate(
                signature: signatureDataSet,
                supportedType: typeof(DataSet),
                serializeEx: SerializeDataSet,
                deserializeEx: DeserializeDataSet,
                calculateDependencies: new SurrogateDependencyCalculation[]
            {
                (obj, dependenciesContext) => NODATASET_DEPENDENCIES
            });
        }
 /// <summary>
 /// Method to register a surrogate in order to save the State of the method being executed.
 /// </summary>
 /// <param name="codePromiseType"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 internal static void RegisterSurrogateForDisplayClass(Type codePromiseType, object target, string parentSurrogateId = null)
 {
     //Lets register the surrogate only if it's not already registered.
     if (!SurrogatesDirectory.IsSurrogateRegistered(codePromiseType))
     {
         var signature = SurrogatesDirectory.GenerateNewSurrogateFromType(codePromiseType);
         var surrogateForDisplayClass = new SurrogateForDisplayClass(codePromiseType, signature);
         SurrogatesDirectory.RegisterSurrogate(
             signature: signature,
             supportedType: codePromiseType,
             serializeEx: surrogateForDisplayClass.Serialize,
             deserializeEx: surrogateForDisplayClass.Deserialize,
             calculateDependencies: new SurrogateDependencyCalculation[] { surrogateForDisplayClass.CalculateDependencies });
     }
 }
    public static void RegisterSurrogateForCommand()
    {
        Debug.WriteLine("Registering surrogate for DbCommand");
        var signature = SurrogatesDirectory.ValidSignature("cmd");

        SurrogatesDirectory.RegisterSurrogate(
            signature: signature,
            supportedType: typeof(System.Data.Common.DbCommand),
            applyBindingAction: null,
            serializeEx: Serialize,
            deserializeEx: Deserialize,
            calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDependencies });


        Debug.WriteLine("Registering surrogate for OleDbCommand");
        signature = SurrogatesDirectory.ValidSignature("cmd1");
        SurrogatesDirectory.RegisterSurrogate(
            signature: signature,
            supportedType: typeof(System.Data.OleDb.OleDbCommand),
            applyBindingAction: null,
            serializeEx: Serialize,
            deserializeEx: Deserialize,
            calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDependencies }
            );


        Debug.WriteLine("Registering surrogate for OdbcCommand");
        signature = SurrogatesDirectory.ValidSignature("cmd2");
        SurrogatesDirectory.RegisterSurrogate(
            signature: signature,
            supportedType: typeof(System.Data.Odbc.OdbcCommand),
            applyBindingAction: null,
            serializeEx: Serialize,
            deserializeEx: Deserialize,
            calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDependencies }
            );

        signature = SurrogatesDirectory.ValidSignature("cmd3");
        Debug.WriteLine("Registering surrogate for SqlCommand");
        SurrogatesDirectory.RegisterSurrogate(
            signature: signature,
            supportedType: typeof(System.Data.SqlClient.SqlCommand),
            applyBindingAction: null,
            serializeEx: Serialize,
            deserializeEx: Deserialize,
            calculateDependencies: new SurrogateDependencyCalculation[] { CalculateDependencies }
            );
    }
        public static void RegisterSurrogateForDataTable()
        {
            string signature = SurrogatesDirectory.ValidSignature("DTABLE");

            SurrogatesDirectory.RegisterSurrogate(
                signature: signature,
                supportedType: typeof(System.Data.DataTable),
                applyBindingAction: null,
                calculateDependencies: CalculateDependencies,

                writeComparer: ExtractDependencyIdentifier,
                serializeEx: SerializeDataTable,
                deserializeEx: DeserializeDataTable,
                isValidDependency: IsValidDependency
                );
        }
Esempio n. 10
0
        public static void RegisterForAssembly()
        {
            Debug.WriteLine("Registering surrogate for Assembly");
            var signature = SurrogatesDirectory.ValidSignature("asse1");

            SurrogatesDirectory.RegisterSurrogate(
                signature: signature,
                supportedType: typeof(System.Reflection.Assembly),
                applyBindingAction: null,
                serializeEx: Serialize,
                deserializeEx: Deserialize
                );

            var runtimeAssembly = Type.GetType("System.Reflection.RuntimeAssembly");

            Debug.WriteLine("Registering surrogate for RuntimeAssembly");
            signature = SurrogatesDirectory.ValidSignature("asse2");
            SurrogatesDirectory.RegisterSurrogate(signature: signature,
                                                  supportedType: runtimeAssembly,
                                                  serializeEx: Serialize,
                                                  deserializeEx: Deserialize);
        }
 public void RegisterSurrogate(string signature, Type supportedType, Action <object, Action <bool> > applyBindingAction = null, Func <object, string, object> PropertyGetter = null, Action <object, string, object> PropertySetter = null)
 {
     SurrogatesDirectory.RegisterSurrogate(signature, supportedType, applyBindingAction, PropertyGetter, PropertySetter);
 }