/// <summary> /// Вносит данные из загруженных файлов в базу данных используя BulkLoader. /// </summary> /// <param name="serverTableType"></param> тип используемых временных таблиц для загрузки public void BulkLoad(ServerTableType serverTableType) { try { SetBulkLists(serverTableType); switch (serverTableType) { case ServerTableType.Schema: //ClearTables.ExecuteNonQuery(); break; case ServerTableType.GlobalTemp: CreateTempFiasTables.ExecuteNonQuery(); break; case ServerTableType.ConnectionTemp: break; } OperatingsLoad(); } finally { switch (serverTableType) { case ServerTableType.Schema: break; case ServerTableType.GlobalTemp: break; case ServerTableType.ConnectionTemp: break; } } }
public void MergeDB(ServerTableType serverTableType) { switch (serverTableType) { case ServerTableType.Schema: MERGE_fias_ActualStatus.ExecuteNonQuery(); MERGE_fias_AddressObjectType.ExecuteNonQuery(); MERGE_fias_CenterStatus.ExecuteNonQuery(); MERGE_fias_CurrentStatus.ExecuteNonQuery(); MERGE_fias_EstateStatus.ExecuteNonQuery(); MERGE_fias_HouseStateStatus.ExecuteNonQuery(); MERGE_fias_NormativeDocumentType.ExecuteNonQuery(); MERGE_fias_OperationStatus.ExecuteNonQuery(); MERGE_fias_RoomType.ExecuteNonQuery(); MERGE_fias_StructureStatus.ExecuteNonQuery(); MERGE_fias_NormativeDocument.ExecuteNonQuery(); MERGE_fias_Object.ExecuteNonQuery(); MERGE_fias_House.ExecuteNonQuery(); MERGE_fias_Room.ExecuteNonQuery(); MERGE_fias_Stead.ExecuteNonQuery(); break; case ServerTableType.GlobalTemp: MERGE_GlobalTempActualStatus.ExecuteNonQuery(); MERGE_GlobalTempAddressObjectType.ExecuteNonQuery(); MERGE_GlobalTempCenterStatus.ExecuteNonQuery(); MERGE_GlobalTempCurrentStatus.ExecuteNonQuery(); MERGE_GlobalTempEstateStatus.ExecuteNonQuery(); MERGE_GlobalTempHouseStateStatus.ExecuteNonQuery(); MERGE_GlobalTempNormativeDocumentType.ExecuteNonQuery(); MERGE_GlobalTempOperationStatus.ExecuteNonQuery(); MERGE_GlobalTempRoomType.ExecuteNonQuery(); MERGE_GlobalTempStructureStatus.ExecuteNonQuery(); MERGE_GlobalTempNormativeDocument.ExecuteNonQuery(); MERGE_GlobalTempObject.ExecuteNonQuery(); MERGE_GlobalTempHouse.ExecuteNonQuery(); MERGE_GlobalTempRoom.ExecuteNonQuery(); MERGE_GlobalTempStead.ExecuteNonQuery(); break; case ServerTableType.ConnectionTemp: MERGE_LocalTempActualStatus.ExecuteNonQuery(); MERGE_LocalTempAddressObjectType.ExecuteNonQuery(); MERGE_LocalTempCenterStatus.ExecuteNonQuery(); MERGE_LocalTempCurrentStatus.ExecuteNonQuery(); MERGE_LocalTempEstateStatus.ExecuteNonQuery(); MERGE_LocalTempHouseStateStatus.ExecuteNonQuery(); MERGE_LocalTempNormativeDocumentType.ExecuteNonQuery(); MERGE_LocalTempOperationStatus.ExecuteNonQuery(); MERGE_LocalTempRoomType.ExecuteNonQuery(); MERGE_LocalTempStructureStatus.ExecuteNonQuery(); MERGE_LocalTempNormativeDocument.ExecuteNonQuery(); MERGE_LocalTempObject.ExecuteNonQuery(); MERGE_LocalTempHouse.ExecuteNonQuery(); MERGE_LocalTempRoom.ExecuteNonQuery(); MERGE_LocalTempStead.ExecuteNonQuery(); break; } }
/// <summary> /// /// </summary> /// <param name="serverTableType"></param> protected void SetBulkLists(ServerTableType serverTableType) { List <IMerge> bulkList = new List <IMerge>(); foreach (var pattern in patterns) { foreach (FileInfo file in Rootdir.GetFiles(pattern.Pattern).OrderBy(file => file.Length)) { bulkList.Add(new BulkTableOperator(pattern.TableName, SchemaName, file, serverTableType, Connection)); } } OperatingLists.Add(bulkList); }
public BulkTableOperator(string tableName, string tableSchema, FileInfo file, ServerTableType serverTableType = ServerTableType.Schema, SqlConnection connection = null) : base(file, connection) { TableName = tableName; TableSchema = tableSchema; ServerTableType = serverTableType; }