Пример #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);
        }
Пример #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);
        }
Пример #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 }
                );
        }
Пример #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 });
        }
Пример #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
            });
        }
    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
                );
        }
Пример #9
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 string ValidSignature(string signature)
 {
     return(SurrogatesDirectory.ValidSignature(signature));
 }