public void Act() { using (var source = _connectionFactory.CreateConnection(_schemaMetadata[ConnectionStringName.CustomerIntelligence])) using (var target = _connectionFactory.CreateConnection(_schemaMetadata[ConnectionStringName.Statistics])) { var transformed = source.GetTable <CI::FirmCategory>() .Select(x => new Statistics::FirmCategoryStatistics { FirmId = x.FirmId, CategoryId = x.CategoryId }) .ToArray(); target.GetTable <Statistics::FirmCategoryStatistics>().BulkCopy(transformed); } }
private IBulkReplicatorFactory CreateReplicatorFactory(BulkReplicationMetadataElement bulkReplicationMetadata) { var sourceStorageDescriptor = bulkReplicationMetadata.Features.OfType <StorageDescriptorFeature>().Single(x => x.Direction == ReplicationDirection.From); var targetStorageDescriptor = bulkReplicationMetadata.Features.OfType <StorageDescriptorFeature>().Single(x => x.Direction == ReplicationDirection.To); return(new RoutingBulkReplicatorFactory(_dataConnectionFactory.CreateConnection(sourceStorageDescriptor), _dataConnectionFactory.CreateConnection(targetStorageDescriptor))); }
protected override void Execute(SchemaMetadataElement metadataElement) { var entities = _contextEntityTypesProvider.GetTypesFromContext(metadataElement.Context); using (var dataConnection = _dataConnectionFactory.CreateConnection(metadataElement)) { var sqlSchemaService = new SqlSchemaService(dataConnection); sqlSchemaService.CreateTables(entities); } }