public static IntegerId IntegerId(this Element element) { if (element == null) { return(null); } IntegerId integerId = Convert.ToSAM(element.Id); if (integerId == null) { return(null); } ParameterSet parameterSet = new ParameterSet(element.GetType()?.Assembly); parameterSet.Add("Name", Query.FullName(element)); string categoryName = null; if (element is Family) { categoryName = ((Family)element).FamilyCategory?.Name; } else { categoryName = element.Category?.Name; } parameterSet.Add("Category Name", categoryName); integerId.Add(parameterSet); return(integerId); }
ParameterSet GetChanges() { ParameterSet original = new ParameterSet(); original.Add(new ObjectTree(new Extractor(), "Extractor")); original.Add(new ObjectTree(new ParallelMatcher(), "Matcher")); return(Parameters.GetDifferences(original)); }
public void Run() { SetTimeouts(); ParameterSet previous = null; ParameterSet trial = new ParameterSet(); trial.Add(new ObjectTree(ExtractorBenchmark.Extractor, "Extractor")); trial.Add(new ObjectTree(MatcherBenchmark.Matcher, "Matcher")); while (true) { ExtractorBenchmark.Extractor = new Extractor(); MatcherBenchmark.Matcher = new ParallelMatcher(); trial.Rebind(new ObjectTree(ExtractorBenchmark.Extractor, "Extractor")); trial.Rebind(new ObjectTree(MatcherBenchmark.Matcher, "Matcher")); trial.SaveValues(); TestReport report = new TestReport(); report.Configuration.Parameters = trial.Clone(); bool improved = false; try { report.Extractor = NicheSlot.GetCachedTemplates(trial); if (report.Extractor == null) { report.Extractor = ExtractorBenchmark.Run(); } report.Configuration.DatabaseStatistics.Collect(report.Extractor.Templates); MatcherBenchmark.TestDatabase = report.Extractor.Templates; report.Matcher = MatcherBenchmark.Run(); improved = NicheSlot.Fit(report); } catch (Exception e) { if (OnException != null) { OnException(e); } } if (NicheSlot.BestSolution == null) { throw new ApplicationException("Initial parameter set doesn't meet basic NicheSlot criteria"); } if (previous != null) { Mutations.Feedback(previous, trial, improved); } previous = NicheSlot.BestSolution.Configuration.Parameters; trial = Mutations.Mutate(previous); } }
public static void RefreshFoundationProcessData(int id) { FoundationProcessData = new DataTable(); FoundationProcessData.Columns.Add("ProcessId", typeof(int)); FoundationProcessData.Columns.Add("ProcessDisplayText"); var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "FOUNDATION_ID", id); var command = new Command { SqlStatementId = "SELECT_FOUNDATION_PROCESS_INFO", ParameterCollection = parameters }; var access = new DataAccess(); using (MySqlDataReader reader = access.GetReader(command)) { FoundationProcessData.Load(reader); DataRow row = FoundationProcessData.NewRow(); row["ProcessDisplayText"] = "All"; row["ProcessId"] = -999; FoundationProcessData.Rows.InsertAt(row, 0); reader.Close(); } }
public static Space ToSAM(this TSD.ZoneData zoneData, IEnumerable <SpaceDataType> spaceDataTypes = null) { ParameterSet parameterSet = Create.ParameterSet_Space(ActiveSetting.Setting, zoneData); if (spaceDataTypes != null) { foreach (SpaceDataType spaceDataType in spaceDataTypes) { List <double> values = zoneData.AnnualZoneResult <double>(spaceDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(spaceDataType.Text(), jArray); } } Space space = new Space(zoneData.name, null); space.Add(parameterSet); return(space); }
public static List <int> GetAllFoundationIds(int startIndex) { var parameters = new ParameterSet(); parameters.Add(DbType.String, "START_INDEX", startIndex); var command = new Command { SqlStatementId = "SELECT_ALL_FOUNDATION_ID", ParameterCollection = parameters }; var access = new DataAccess(); List <int> foundationIds = new List <int>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { foundationIds.Add(reader.GetInt32(0)); } } } return(foundationIds); }
public static List <FoundationDataFileState.FileInfo> RetrieveAllSharedInfo(int foundationId) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "FOUNDATION_ID", foundationId); var command = new Command { SqlStatementId = "SELECT_ALL_SHARED_INFO", ParameterCollection = parameters }; var access = new DataAccess(); var requestSupporitngFiles = new List <FoundationDataFileState.FileInfo>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { var fileIds = new FoundationDataFileState.FileInfo { DocumentId = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0), FileName = reader.IsDBNull(1) ? "" : reader.GetString(1) }; fileIds.FilePath = "\\Shared_Documents\\" + fileIds.FileName; requestSupporitngFiles.Add(fileIds); } } } return(requestSupporitngFiles); }
/// <summary> /// Executes a stored procedure. /// </summary> /// <param name="procedureName">The procedure name.</param> /// <param name="parameters">The set of parameters.</param> /// <param name="outputParameters">The set of output parameters.</param> /// <param name="resultCallback">The result callback.</param> /// <param name="returnValue">The procedure result.</param> public void ExecuteStoredProcedure(string procedureName, ParameterSet parameters, ParameterSet outputParameters, Action <IDatabaseResult> resultCallback, out int returnValue) { ThrowIf.NullOrWhiteSpace(procedureName, "procedureName"); ThrowIf.Null(parameters, "parameters"); int?procedureReturnValue = null; if (this.settings != null) { var settingsParameter = new QueryResultSettingsTableType(this.settings); parameters.Add(QueryResultSettingsTableType.ParameterName, settingsParameter.DataTable); } RetryPolicy retryPolicy = this.DatabaseProvider.GetRetryPolicy(); try { retryPolicy.ExecuteAction( () => this.DatabaseProvider.ExecuteStoredProcedure(this.ConnectionManager.Connection, procedureName, parameters, outputParameters, resultCallback, out procedureReturnValue), (policy, retryCount, ex) => RetailLogger.Log.CrtDataAccessTransientExceptionOccurred(policy.RetryCount, policy.RetryInterval, retryCount, ex)); } catch (DatabaseException ex) { throw new StorageException( StorageErrors.Microsoft_Dynamics_Commerce_Runtime_CriticalStorageError, (int)ex.ErrorCode, ex, "Failed to read from the database. See inner exception for details"); } returnValue = procedureReturnValue.GetValueOrDefault(0); }
public static List <FoundationDataFileState.FileInfo> RetrieveAllMergeTemplateInfoByFoundation(int foundationId) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "FOUNDATION_ID", foundationId); var command = new Command { SqlStatementId = "SELECT_ALL_MERGE_TEMPLATE_INFO_BY_FOUNDATION", ParameterCollection = parameters }; var access = new DataAccess(); var requestSupportingFiles = new List <FoundationDataFileState.FileInfo>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { var fileIds = new FoundationDataFileState.FileInfo { MergeTemplateId = reader.IsDBNull(0) ? -1 : reader.GetInt32(0), FileName = reader.IsDBNull(1) ? "" : reader.GetString(1) }; fileIds.FilePath = "\\Merge_Templates\\" + fileIds.MergeTemplateId + "_" + fileIds.FileName; requestSupportingFiles.Add(fileIds); } } } return(requestSupportingFiles); }
public static ParameterSet ParameterSet(this Setting setting, shade shade) { ParameterSet parameterSet = Core.Tas.Create.ParameterSet(setting, shade, typeof(Panel), typeof(shade)); parameterSet.Add("IsUsed", shade.isUsed == 1); return(parameterSet); }
public static ParameterSet ParameterSet(this Setting setting, TAS3D.Zone zone) { ParameterSet parameterSet = Core.Tas.Create.ParameterSet(setting, zone, typeof(Space), typeof(Zone)); parameterSet.Add("IsUsed", zone.isUsed == 1); return(parameterSet); }
public static ParameterSet ParameterSet(this Setting setting, window window) { ParameterSet parameterSet = Core.Tas.Create.ParameterSet(setting, window, typeof(Aperture), typeof(window)); parameterSet.Add("IsUsed", window.isUsed == 1); return(parameterSet); }
public static ParameterSet ParameterSet(this Setting setting, Element element) { ParameterSet parameterSet = Core.Tas.Create.ParameterSet(setting, element, typeof(Panel), typeof(Element)); parameterSet.Add("IsUsed", element.isUsed == 1); return(parameterSet); }
public void GetParameterSets_ReturnsSetWithParameterFromEachBuilder() { var paramProvider = new ParameterProvider(); var builders = new IParameterValueBuilder[] { new FakeParameterValueBuilder("ParamOne", 1), new FakeParameterValueBuilder("ParamTwo", 2) }; var set = paramProvider.GetParameterSets(builders, numberOfSets: 1).Single(); var expected = new ParameterSet(); expected.Add(new ParameterValue("ParamOne", 1)); expected.Add(new ParameterValue("ParamTwo", 2)); set.Parameters.Should().BeEquivalentTo(expected.Parameters); }
private OMVSD.OSDMap PostActionLogin(OMVSD.OSD body) { OMVSD.OSDMap ret = new OMVSD.OSDMap(); ParameterSet loginParams = new ParameterSet(); try { OMVSD.OSDMap paramMap = (OMVSD.OSDMap)body; loginParams.Add(CommLLLP.FIELDFIRST, paramMap["LOGINFIRST"].AsString()); loginParams.Add(CommLLLP.FIELDLAST, paramMap["LOGINLAST"].AsString()); loginParams.Add(CommLLLP.FIELDPASS, paramMap["LOGINPASS"].AsString()); loginParams.Add(CommLLLP.FIELDGRID, paramMap["LOGINGRID"].AsString()); loginParams.Add(CommLLLP.FIELDSIM, paramMap["LOGINSIM"].AsString()); } catch { m_log.Log(LogLevel.DBADERROR, "MISFORMED POST REQUEST: "); ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1)); ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Misformed POST request")); return(ret); } try { if (!m_comm.Connect(loginParams)) { m_log.Log(LogLevel.DBADERROR, "CONNECT FAILED"); ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1)); ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Could not log in")); return(ret); } } catch (Exception e) { m_log.Log(LogLevel.DBADERROR, "CONNECT EXCEPTION: " + e.ToString()); ret.Add(RestHandler.RESTREQUESTERRORCODE, new OMVSD.OSDInteger(1)); ret.Add(RestHandler.RESTREQUESTERRORMSG, new OMVSD.OSDString("Connection threw exception: " + e.ToString())); return(ret); } return(ret); }
private bool Add(string name, object value) { if (name == null) { return(false); } if (parameterSet == null) { parameterSet = new ParameterSet(string.Empty); } return(parameterSet.Add(name, value as dynamic)); }
public static string GetMergeTemplateFileName(int mergeTemplateId) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "MERGE_TEMPLATE_ID", mergeTemplateId); var command = new Command { SqlStatementId = "SELECT_MERGE_TEMPLATE_FILE_NAME_BY_ID", ParameterCollection = parameters }; var access = new DataAccess(); return(access.GetStringValue(command)); }
public static int GetFoundationId(string urlKey) { var parameters = new ParameterSet(); parameters.Add(DbType.String, "FOUNDATION_URLKEY", urlKey); var command = new Command { SqlStatementId = "SELECT_FOUNDATION_ID", ParameterCollection = parameters }; var access = new DataAccess(); return(access.GetIntValue(command)); }
public static string GetCustomPrintPacketFileName(int settingValueId) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "SETTING_VALUE_ID", settingValueId); var command = new Command { SqlStatementId = "SELECT_CUSTOM_PRINT_PACKET_FILE_NAME_BY_ID", ParameterCollection = parameters }; var access = new DataAccess(); return(access.GetStringValue(command)); }
public static Dictionary <string, string> GetFoundationFileList(int foundationId) { var fileList = new Dictionary <string, string>(); var queryIds = new List <string> { "SELECT_SHARED_FILES_BY_FOUNDATION_ID", "SELECT_ORG_SUPPORTING_DOCUMENTS_BY_FOUNDATION_ID", "SELECT_REQUEST_SUPPORTING_DOCUMENTS_BY_FOUNDATION_ID", "SELECT_REQUEST_FILES_BY_FOUNDATION_ID", }; var parameters = new ParameterSet(); parameters.Add(DbType.String, "FOUNDATION_ID", foundationId); var access = new DataAccess(); foreach (string queryId in queryIds) { var command = new Command { SqlStatementId = queryId, ParameterCollection = parameters }; using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { string filePath = reader.GetString(0); string fileName = (!reader.IsDBNull(1) ? reader.GetString(1) : "").Split(new[] { "[:|:]" }, StringSplitOptions.None)[0]; filePath += fileName.Split('.').Last(); if (!string.IsNullOrEmpty(fileName) && !fileList.Keys.Contains(filePath)) { fileList.Add(filePath, fileName); } } } } } return(fileList); }
public static List <FoundationDataFileState.FileInfo> RetrieveAllRequestInfo(int foundationId) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "FOUNDATION_ID", foundationId); var command = new Command { SqlStatementId = "SELECT_ALL_REQUEST_INFO", ParameterCollection = parameters }; var access = new DataAccess(); var requestSupporitngFiles = new List <FoundationDataFileState.FileInfo>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { var fileIds = new FoundationDataFileState.FileInfo { AnswerId = reader.GetGuid(0), SubmissionId = reader.IsDBNull(1) ? -1 : reader.GetInt32(1), RequestId = reader.IsDBNull(2) ? -1 : reader.GetInt32(2), FileName = reader.IsDBNull(3) ? "" : reader.GetString(3) .Split(new [] { "[:|:]" }, StringSplitOptions.None)[0], Question = reader.IsDBNull(5) ? "" : reader.GetString(5), ProcessId = reader.IsDBNull(7) ? -1 : reader.GetInt32(7), RequestGuid = reader.IsDBNull(8) ? Guid.Empty : reader.GetGuid(8) }; fileIds.FilePath = "Requests\\Submissions\\" + fileIds.RequestId + "_" + fileIds.SubmissionId + "_" + fileIds.FileName; requestSupporitngFiles.Add(fileIds); } } } return(requestSupporitngFiles); }
public static SpaceSimulationResult ToSAM_SpaceSimulationResult(this TSD.ZoneData zoneData, IEnumerable <SpaceDataType> spaceDataTypes = null) { SpaceSimulationResult result = new SpaceSimulationResult(zoneData.name, Assembly.GetExecutingAssembly().GetName()?.Name, zoneData.zoneGUID); result.SetValue("Zone Number", zoneData.zoneNumber); result.SetValue("Description", zoneData.description); result.SetValue("Convective Weighting Factors Count", zoneData.nConvWeightingFactors); result.SetValue("Radiat Weighting Factors Count", zoneData.nRadWeightingFactors); result.SetValue(Analytical.SpaceSimulationResultParameter.Area, zoneData.floorArea); result.SetValue(Analytical.SpaceSimulationResultParameter.Volume, zoneData.volume); result.SetValue("Convective Common Ratio", zoneData.convectiveCommonRatio); result.SetValue("Radiat Common Ratio", zoneData.radiantCommonRatio); ParameterSet parameterSet = Create.ParameterSet_SpaceSimulationResult(ActiveSetting.Setting, zoneData); if (spaceDataTypes != null) { foreach (SpaceDataType spaceDataType in spaceDataTypes) { List <double> values = zoneData.AnnualZoneResult <double>(spaceDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(spaceDataType.Text(), jArray); } } result.Add(parameterSet); result.SetValue(SpaceSimulationResultParameter.ZoneGuid, zoneData.zoneGUID); return(result); }
/// <summary> /// Adds the specified parameter to this instance. /// </summary> /// <param name="name">The name to consider.</param> /// <param name="valueType">The data value type to consider.</param> /// <param name="value">The data table to consider.</param> /// <returns>Return this added parameter.</returns> public ScalarElement UseParameter( string name, DataValueTypes valueType, object value = null) { if (ParameterSet == null) { ParameterSet = new DataElementSet(); } if (ParameterSet[name] is ScalarElement parameter) { parameter.WithItems(value); } else { parameter = ElementFactory.CreateScalar(name, valueType, value); parameter.Index = ParameterSet.Count + 1; ParameterSet.Add(parameter); } return parameter; }
public static List <UnsyncedAnswer> GetUnsyncAnswers(int foundationId) { var parameters = new ParameterSet(); parameters.Add(DbType.String, "FOUNDATION_ID", foundationId); var command = new Command { SqlStatementId = "SELECT_UNSYNCED_ANSWERS", ParameterCollection = parameters }; var access = new DataAccess(); List <UnsyncedAnswer> unsyncedAnswers = new List <UnsyncedAnswer>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { var unsyncedAnswer = new UnsyncedAnswer { UrlKey = reader.GetString(0), RequestId = reader.IsDBNull(1) ? -1 : reader.GetInt32(1), FieldCode = reader.GetString(2), UnsyncedCount = reader.IsDBNull(3) ? -1 : reader.GetInt32(3), }; unsyncedAnswers.Add(unsyncedAnswer); } } } return(unsyncedAnswers); }
public static List <FoundationDataFileState.FileInfo> RetrieveAllOrganizationSupportingInfo(int foundationId) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "FOUNDATION_ID", foundationId); var command = new Command { SqlStatementId = "SELECT_ALL_ORGANIZATION_SUPPORTING_INFO", ParameterCollection = parameters }; var access = new DataAccess(); var requestSupporitngFiles = new List <FoundationDataFileState.FileInfo>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { var fileIds = new FoundationDataFileState.FileInfo { OrganizationId = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0), DocumentId = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1), FileName = reader.IsDBNull(2) ? "" : reader.GetString(2), OrganizationName = reader.IsDBNull(4) ? "" : reader.GetString(4), OrganizationTaxId = reader.IsDBNull(5) ? "" : reader.GetString(5), }; fileIds.FilePath = "\\Organizations\\" + fileIds.OrganizationId + "_OS_" + fileIds.FileName; requestSupporitngFiles.Add(fileIds); } } } return(requestSupporitngFiles); }
public static PartitionSimulationResult ToSAM_PartitionSimulationResult(this SurfaceData surfaceData, IEnumerable <PanelDataType> panelDataTypes = null) { if (surfaceData == null) { return(null); } PartitionSimulationResult result = new PartitionSimulationResult(surfaceData.BEName, Assembly.GetExecutingAssembly().GetName()?.Name, surfaceData.surfaceNumber.ToString()); result.SetValue("BuildingElementType", ((TBD.BuildingElementType)surfaceData.BEType).ToString()); result.SetValue("Area", surfaceData.area); result.SetValue("Orientation", surfaceData.orientation); ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, surfaceData); if (panelDataTypes != null) { foreach (PanelDataType panelDataType in panelDataTypes) { List <double> values = surfaceData.AnnualSurfaceResult <double>(panelDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(panelDataType.Text(), jArray); } } result.Add(parameterSet); return(result); }
public static List <FoundationDataFileState.FileInfo> RetrieveRequestSupportingInfo(int foundationProcess) { var parameters = new ParameterSet(); parameters.Add(DbType.Int32, "FOUNDATION_PROCESS", foundationProcess); var command = new Command { SqlStatementId = "SELECT_REQUEST_SUPPORTING_INFO", ParameterCollection = parameters }; var access = new DataAccess(); var requestSupporitngFiles = new List <FoundationDataFileState.FileInfo>(); using (MySqlDataReader reader = access.GetReader(command)) { while (reader.Read()) { if (!reader.IsDBNull(0)) { var fileIds = new FoundationDataFileState.FileInfo { RequestId = reader.GetInt32(0), DocumentId = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1), FileName = reader.IsDBNull(2) ? "" : reader.GetString(2), RequestGuid = reader.IsDBNull(4) ? Guid.Empty : reader.GetGuid(4), }; fileIds.FilePath = "\\Requests\\Supporting\\" + fileIds.RequestId + "_RS_" + fileIds.FileName; requestSupporitngFiles.Add(fileIds); } } } return(requestSupporitngFiles); }
public static Panel ToSAM(this SurfaceData surfaceData, IEnumerable <PanelDataType> panelDataTypes = null) { if (surfaceData == null) { return(null); } ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, surfaceData); if (panelDataTypes != null) { foreach (PanelDataType panelDataType in panelDataTypes) { List <double> values = surfaceData.AnnualSurfaceResult <double>(panelDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(panelDataType.Text(), jArray); } } PanelType panelType = Query.PanelType(surfaceData.BEType); PlanarBoundary3D planarBoundary3D = null; Panel panel = Analytical.Create.Panel(new Construction(surfaceData.BEName), panelType, planarBoundary3D); panel.Add(parameterSet); return(panel); }
public PeaSettings() { ParameterSet.Add(new PeaSettingsNamedValue(ParameterNames.ArchipelagosCount, 1)); ParameterSet.Add(new PeaSettingsNamedValue(ParameterNames.IslandsCount, 1)); }
/// <summary> /// Schreiben der Daten in die Zieltabelle mittel Reader /// </summary> /// <param name="reader"></param> public void WriteToServer(IDataReader reader) { SchemaTable = Connection.GetSchema("Columns", new string[] { string.Empty, string.Empty, DestinationTableName }); SchemaTable.DefaultView.Sort = "COLUMN_NAME"; // Tabelle der Zielnamen ParameterSet.Clear(); if (reader.FieldCount != SchemaTable.Rows.Count) { throw new InvalidOperationException($"Columns of reader differs from table {DestinationTableName}"); } // Mapping Ziel-Felder => Reader-Felder int[] mapIndex = new int[reader.FieldCount]; Dictionary <string, int> mapNames = new Dictionary <string, int>(); for (int i = 0; i < reader.FieldCount; i++) { mapNames[reader.GetName(i)] = i; } InsertCommand = Connection.CreateCommand(); foreach (DataRow row in SchemaTable.Rows) // Reihenfolge der Zieltablle { string name = $"{row["COLUMN_NAME"]}".Trim(); if (!mapNames.TryGetValue(name, out int pos)) { throw new InvalidOperationException($"Column {name} not found in table {DestinationTableName}"); } mapIndex[Convert.ToInt32(row["ORDINAL_POSITION"])] = pos; // Spaltenmapping string columncast = "BLOB SUB_TYPE 0"; // unbekannt InputParameter parameter = new InputParameter(); parameter.DbType = DbType.Object; switch ($"{row["COLUMN_DATA_TYPE"]}".ToUpper()) { case "DATE": columncast = "date"; parameter.DbType = DbType.DateTime; break; case "CHAR": columncast = $"char({(int)row["COLUMN_SIZE"]})"; parameter.DbType = DbType.String; break; case "VARCHAR": columncast = $"varchar({(int)row["COLUMN_SIZE"]})"; if ($"{row["CHARACTER_SET_NAME"]}".Trim() == "NONE") { columncast += " CHARACTER SET NONE"; } parameter.DbType = DbType.String; break; case "DOUBLE PRECISION": columncast = "double precision"; parameter.DbType = DbType.Double; break; case "BIGINT": columncast = "bigint"; parameter.DbType = DbType.Int64; break; case "INTEGER": columncast = "integer"; parameter.DbType = DbType.Int32; break; case "DECIMAL": columncast = $"decimal({(int)row["NUMERIC_PRECISION"]},{(int)row["NUMERIC_SCALE"]})"; parameter.DbType = DbType.Decimal; break; case "BLOB SUB_TYPE 1": columncast = "BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET UTF8"; parameter.DbType = DbType.String; break; } parameter.CastValue = $"{columncast}=?"; ParameterSet.Add(parameter); } int numRows = CreateInsertCommand(int.MaxValue); long currentRows = 0; int insertRows = 0; int numFields = reader.FieldCount; InsertCommand.Transaction = Connection.BeginTransaction(IsolationLevel.ReadCommitted); List <object[]> rowValues = new List <object[]>(numRows); try { object[] values = new object[numFields]; while (reader.Read()) { reader.GetValues(values); object[] mapValues = new object[numFields]; for (int i = 0; i < numFields; i++) { mapValues[i] = values[mapIndex[i]]; } rowValues.Add(mapValues); currentRows++; // Anzahl insgesamt if (currentRows % NotifyAfter == 0) { FbRowsCopiedEventArgs args = new FbRowsCopiedEventArgs(currentRows); FbRowsCopied?.Invoke(this, args); if (args.Abort) { throw new OperationCanceledException("Operation canceled!"); } } insertRows++; // eingefügte Zeilen if (rowValues.Count == numRows) { ExecuteInsert(rowValues); rowValues.Clear(); // wieder freigeben if (insertRows >= BatchSize) { insertRows = 0; InsertCommand.Transaction.Commit(); InsertCommand.Transaction = Connection.BeginTransaction(); } } } if (rowValues.Count > 0) { CreateInsertCommand(rowValues.Count); ExecuteInsert(rowValues); } InsertCommand.Transaction.Commit(); } catch (Exception exBulk) { InsertCommand.Transaction.Rollback(); throw; } }