public BulkReplicationAdapter(ActMetadataElement metadata, IMetadataProvider metadataProvider, ConnectionStringSettingsAspect connectionStringSettings)
 {
     _key = new T();
     _connectionStringSettings = MappedConnectionStringSettings.CreateMappedSettings(
         connectionStringSettings,
         metadata,
         metadataProvider.GetMetadataSet <SchemaMetadataIdentity>().Metadata.Values.Cast <SchemaMetadataElement>().ToDictionary(x => x.Context, x => x));
 }
        public static IConnectionStringSettings CreateMappedSettings(IConnectionStringSettings baseSettings, ActMetadataElement actMetadata, IDictionary<string, SchemaMetadataElement> schemaMetadata)
        {
            var mapping = new Dictionary<IConnectionStringIdentity, IConnectionStringIdentity>();

            foreach (var context in new[] { actMetadata.Source, actMetadata.Target })
            {
                var contextDbConnection = schemaMetadata[context].ConnectionStringIdentity;
                var bulktoolDbConnection = Mapping[contextDbConnection];
                mapping.Add(bulktoolDbConnection, contextDbConnection);
            }

            return new MappedConnectionStringSettings(baseSettings, mapping);
        }
Esempio n. 3
0
        public static IConnectionStringSettings CreateMappedSettings(IConnectionStringSettings baseSettings, ActMetadataElement actMetadata, IDictionary <string, SchemaMetadataElement> schemaMetadata)
        {
            var mapping = new Dictionary <IConnectionStringIdentity, IConnectionStringIdentity>();

            foreach (var context in new[] { actMetadata.Source, actMetadata.Target })
            {
                var contextDbConnection  = schemaMetadata[context].ConnectionStringIdentity;
                var bulktoolDbConnection = Mapping[contextDbConnection];
                mapping.Add(bulktoolDbConnection, contextDbConnection);
            }

            return(new MappedConnectionStringSettings(baseSettings, mapping));
        }