// DATA SOURCES public void CreateDataSource(DataSourceInfo dataSourceInfo) { if (Report != null) { UpdateDataSource(null, dataSourceInfo); } }
public static object CreateMarketDataSource(string ContractHandle, object[] Timestamps, object[] MidPrices, object SpreadOpt) { double spread = Utils.GetOptionalParameter(SpreadOpt, 0.0); Contract cc = XLOM.Get <Contract>(ContractHandle); object[] timestamps = Utils.GetVector <object>(Timestamps); double[] midprices = Utils.GetVector <double>(MidPrices); int nData = timestamps.Length; bool oaDate = (timestamps[0].GetType() == typeof(double)); List <ITimestampedDatum> DataSource = new List <ITimestampedDatum>(nData); for (int i = 0; i < nData; ++i) { DateTimeOffset now = new DateTimeOffset((oaDate ? DateTime.FromOADate((double)timestamps[i]) : DateTime.Parse(timestamps[i].ToString())), new TimeSpan(0, 0, 0)); DataSource.Add(new Market(now, cc.Id, (decimal)(midprices[i] * (1 - 0.5 * spread)), (decimal)(midprices[i] * (1 + 0.5 * spread)))); } DataSourceInfo dsi = new DataSourceInfo("InMemoryMarketDataSource", cc.Id, cc.Symbol); if (XLOM.Contains(dsi.ToString())) { XLOM.Remove(dsi.ToString()); } return(XLOM.Add(dsi.ToString(), DataSource)); }
private DataSourceInfoCollection ResolveSharedDataSources(DataSourceInfoCollection reportDataSources) { DataSourceInfoCollection dataSourceInfoCollection = new DataSourceInfoCollection(); foreach (DataSourceInfo reportDataSource in reportDataSources) { if (!reportDataSource.IsReference) { dataSourceInfoCollection.Add(reportDataSource); } else { string dataSourceReference = reportDataSource.DataSourceReference; DataSourceInfo sharedDataSource = this.GetSharedDataSource(dataSourceReference); if (sharedDataSource == null) { throw new ItemNotFoundException(dataSourceReference); } sharedDataSource.ID = reportDataSource.ID; sharedDataSource.Name = reportDataSource.Name; sharedDataSource.OriginalName = reportDataSource.OriginalName; dataSourceInfoCollection.Add(sharedDataSource); } } return(dataSourceInfoCollection); }
private bool CreateControls(Point dropPoint) { using (SceneEditTransaction editTransaction = this.DragModel.Document.CreateEditTransaction(StringTable.UndoUnitDragDropCreateDataboundControl)) { DataContextInfo dataContextInfo = new DataContextEvaluator().Evaluate(this.DragModel.TargetNode); DataSourceInfo other = new DataSourceInfo(new DataSchemaNodePath(this.DragModel.DataSource.PrimaryAbsoluteSchema, this.GetRelativeSchema().Root)); bool flag = false; if (dataContextInfo.DataSource == null || !dataContextInfo.DataSource.IsValidWithSource || dataContextInfo.DataSource.CompareSources(other) != DataSourceMatchCriteria.Exact) { flag = true; } IList <DataSchemaNodePath> relativeSchemaPaths = this.GetRelativeSchemaPaths(); CanvasLikeDataViewLayoutBuilder viewLayoutBuilder = new CanvasLikeDataViewLayoutBuilder(this.DragModel.InsertionPoint.InsertIndex, false); DocumentCompositeNode containerNode = (DocumentCompositeNode)this.DragModel.TargetNode.DocumentNode; DataViewFactory.GenerateDataView(this.DragModel.Platform, this.DragModel.DocumentContext, relativeSchemaPaths, DataViewCategory.Master, containerNode, (IDataViewLayoutBuilder)viewLayoutBuilder); if (flag) { viewLayoutBuilder.RebindFields(this.DragModel.ViewModel, this.DragModel.DataSource.PrimaryAbsoluteSchema, relativeSchemaPaths); } editTransaction.Update(); viewLayoutBuilder.ApplyActiveUserThemeStyle(this.DragModel.ViewModel); viewLayoutBuilder.CompleteLayout(this.DragModel.ViewModel, dropPoint); viewLayoutBuilder.SelectElements(this.DragModel.ViewModel); editTransaction.Commit(); } return(true); }
public void HandleImpersonation(IProcessingDataSource dataSource, DataSourceInfo dataSourceInfo, string datasetName, IDbConnection connection, System.Action afterImpersonationAction) { if (afterImpersonationAction != null) { afterImpersonationAction(); } }
public DataSourceInfo GetDataSourceInfo(OnDemandProcessingContext pc) { DataSourceInfo dataSourceInfo = null; if (pc.DataSourceInfos != null) { if (pc.IsSharedDataSetExecutionOnly) { dataSourceInfo = pc.DataSourceInfos.GetForSharedDataSetExecution(); } else { if (Guid.Empty != this.ID) { dataSourceInfo = pc.DataSourceInfos.GetByID(this.ID); } if (dataSourceInfo == null) { dataSourceInfo = pc.DataSourceInfos.GetByName(this.Name, pc.ReportContext); } } if (dataSourceInfo == null) { throw new DataSourceNotFoundException(this.Name); } } //else if (this.DataSourceReference != null) //{ // throw new DataSourceNotFoundException(this.Name); //} return(dataSourceInfo); }
public void TestDataSourcePackageToStringMethod() { try { var dsp = new DataSourcePackage(); var info = new DataSourceInfo(); info.SetSourceLocation("TestPath"); info.SetSourceType <MatchCollection>(); // Should be possible to specify an arbitrary type. dsp.AddDataSource(info); info = new DataSourceInfo(); var dictionary = new ConfigDictionary { { "Key 1", "Value 1" }, { "Key 2", "Value 2" } }; info.SetSourceLocation(dictionary); info.SetSourceType <ResourceFileDataSource>(); dsp.AddDataSource(info); TestContext.WriteLine(dsp.ToString()); } catch (Exception ex) { Assert.Fail("Method Failed:{0}", ex.Message); } }
internal DataSetPublishingResult(DataSetDefinition dataSetDefinition, DataSourceInfo dataSourceInfo, UserLocationFlags userReferenceLocation, ProcessingMessageList warnings) { m_dataSetDefinition = dataSetDefinition; m_dataSourceInfo = dataSourceInfo; m_userReferenceLocation = userReferenceLocation; m_warnings = warnings; }
public static void Main(string[] args) { if (args.Length == 2) { var line = args[1]; string[] dockerArgs=line.Split(','); DataSource = new DataSourceInfo(); foreach (var argument in dockerArgs) { var segment=argument.IndexOf('='); var argName = argument.Substring(0,segment).ToUpper(); var argValue = argument.Substring(segment+1).Replace("'","").Replace(""", ""); if (argName == "CONNECTION_STRING") { DataSource.ConnectionString = argValue; } else if(argName=="DATASOURCE_TYPE") { DataSource.DataSourceType = argValue; } } } CreateHostBuilder(args).Build().Run(); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (DataSourceInfo == null) { throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceInfo"); } if (PolicyInfo == null) { throw new ValidationException(ValidationRules.CannotBeNull, "PolicyInfo"); } if (ObjectType == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ObjectType"); } if (DataSourceInfo != null) { DataSourceInfo.Validate(); } if (DataSourceSetInfo != null) { DataSourceSetInfo.Validate(); } if (PolicyInfo != null) { PolicyInfo.Validate(); } }
private void UpdateDataSourceNode(DataSourceInfo dataSourceInfo, TreeNode dataSourceNode) { if (dataSourceNode != null) { dataSourceNode.Nodes.Clear(); } else { dataSourceNode = CreateNode(DataTree.Nodes["DataSources"], dataSourceInfo.Name, "DataSource", DataSourceMenu); } if (dataSourceInfo.Schema != null) { RenderDataSourceSchemaTree(dataSourceNode, dataSourceInfo.Schema); } dataSourceNode.Name = dataSourceInfo.Name; dataSourceNode.Text = dataSourceNode.Name; dataSourceNode.Collapse(); dataSourceNode.Parent.Expand(); DataTree.SelectedNode = dataSourceNode; }
private void InvokeDataSourceDeleted(DataSourceInfo dataSourceInfo) { if (DataSourceDeleted != null) { DataSourceDeleted(this, new ValueEventArgs <DataSourceInfo>(dataSourceInfo)); } }
private void InvokeDataSourceChanged(DataSourceInfo dataSourceInfo, DataSourceInfo newDataSourceInfo) { if (DataSourceChanged != null) { DataSourceChanged(this, new ChangedEventArgs <DataSourceInfo>(dataSourceInfo, newDataSourceInfo)); } }
public static DataSourceInfo LoadConfig() { var userFolder = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); var configFilePath = Path.Combine(userFolder, ConfigFileName); var lines = File.ReadAllLines(configFilePath); var dataSourceInfo = new DataSourceInfo { SiteUri = lines[0], RestQueryData = new RestQueryData { ListTitle = lines[1], FilterQuery = lines[2], SelectQuery = lines[3], OrderBy = lines[4], Expand = lines[5], MaxResults = int.Parse(lines[6]) }, NetworkCredentials = CredentialUtil.GetCredential(CredentialsEntryName, PersistanceType.LocalComputer) }; return(dataSourceInfo); }
protected IDataReader RunLiveQuery(List <Microsoft.ReportingServices.ReportIntermediateFormat.ParameterValue> queryParams, object[] paramValues) { IDataReader reader = null; IDbCommand command = null; IJobContext jobContext = m_odpContext.JobContext; if (m_dataSourceConnection == null) { m_dataSourceConnection = RuntimeDataSource.OpenConnection(m_dataSource, m_dataSet, m_odpContext, m_executionMetrics); } try { m_executionMetrics.StartTimer(DataProcessingMetrics.MetricType.Query); command = CreateCommand(); SetCommandParameters(command, queryParams, paramValues); string commandText = SetCommandText(command); StoreCommandText(commandText); SetCommandType(command); SetTransaction(command); m_odpContext.CheckAndThrowIfAborted(); SetCommandTimeout(command); ExtractRewrittenCommandText(command); SetRestartPosition(command); DataSourceInfo dataSourceInfo = null; if (command is IDbImpersonationNeededForCommandCancel) { dataSourceInfo = m_dataSource.GetDataSourceInfo(m_odpContext); } m_command = command; m_commandWrappedForCancel = new CommandWrappedForCancel(m_command, m_odpContext.CreateAndSetupDataExtensionFunction, m_dataSource, dataSourceInfo, m_dataSet.Name, m_dataSourceConnection); if (jobContext != null) { jobContext.SetAdditionalCorrelation(m_command); jobContext.ApplyCommandMemoryLimit(m_command); } DataSourceErrorInspector errorInspector = CreateErrorInspector(); reader = ExecuteReader(jobContext, errorInspector, commandText); StoreDataReader(reader, errorInspector); return(reader); } catch (RSException) { EagerInlineCommandAndReaderCleanup(ref reader, ref command); throw; } catch (Exception e) { if (AsynchronousExceptionDetection.IsStoppingException(e)) { throw; } EagerInlineCommandAndReaderCleanup(ref reader, ref command); throw; } finally { m_executionMetrics.RecordTimerMeasurement(DataProcessingMetrics.MetricType.Query); } }
public void ChangeDataSource(DataSourceInfo dataSourceInfo, DataSourceInfo newDataSourceInfo) { if (Report != null) { var dataSource = Report.Dictionary.DataSources.FindByName(dataSourceInfo.Name); UpdateDataSource(dataSource, newDataSourceInfo); } }
public ExecuteQueriesContext(IDbConnection connection, IProcessingDataExtensionConnection dataExtensionConnection, DataSourceInfo dataSourceInfo, CreateAndRegisterStream createAndRegisterStream, IJobContext jobContext) { this.m_connection = connection; this.m_dataExtensionConnection = dataExtensionConnection; this.m_dataSourceInfo = dataSourceInfo; this.m_createAndRegisterStream = createAndRegisterStream; this.m_jobContext = jobContext; }
/// <summary> /// Initializes a new Execution result for success case. /// </summary> /// <param name="context"> /// <see cref="ExecutionContext"/> from the processing state. /// </param> /// <param name="dataSourceInfo"> /// <see cref="DataSourceInfo"/> from the custom data source being processed. /// </param> /// <param name="dataSourceInfoFailure"> /// <see cref="Exception"/> for the processing state (if available). /// </param> /// <param name="processor"> /// <see cref="ICustomDataProcessor"/> associated to the processing state. /// </param> /// <param name="enableFailures"> /// Dictionary representing the failures for <see cref="TableDescriptor"/> (if any). /// </param> /// <param name="metadataName"> /// Name of the custom data source being processed. /// </param> /// <param name="builtMetadataTables"> /// Collection of <see cref="MetadataTableBuilder"/>. /// </param> /// <param name="metadataException"> /// <see cref="Exception"/> for creating metadata tables (if available). /// </param> public ExecutionResult( ExecutionContext context, DataSourceInfo dataSourceInfo, Exception dataSourceInfoFailure, ICustomDataProcessor processor, IDictionary <TableDescriptor, Exception> enableFailures, string metadataName, IEnumerable <MetadataTableBuilder> builtMetadataTables, Exception metadataException) : this(enableFailures, context.TablesToEnable) { Guard.NotNull(context, nameof(context)); Guard.NotNull(dataSourceInfo, nameof(dataSourceInfo)); Guard.NotNull(processor, nameof(processor)); Guard.NotNullOrWhiteSpace(metadataName, nameof(metadataName)); Guard.NotNull(builtMetadataTables, nameof(builtMetadataTables)); this.AssociatedWithCustomDataSource = true; // Exception may be null. this.Context = context; this.Processor = processor; this.DataSourceInfo = dataSourceInfo; this.DataSourceInfoFailure = dataSourceInfoFailure; this.MetadataName = metadataName; this.BuiltMetadataTables = new ReadOnlyCollection <MetadataTableBuilder>(builtMetadataTables.ToList()); this.MetadataTableFailure = metadataException; Debug.Assert(this.RequestedTables != null); // If the processor contains tables that were generated while processing the data source, then add them to our RequestedTables. // todo: RequestedTables - should we rename this? Just make it AvailableTables or something similar? if (processor is IDataDerivedTables postProcessTables && postProcessTables.DataDerivedTables != null) { // do some extra validation on these table descriptors, as they might have been generated by hand // rather than our usual library // foreach (var tableDescriptor in postProcessTables.DataDerivedTables) { if (tableDescriptor.PrebuiltTableConfigurations is null) { var tableConfigurations = new TableConfigurations(tableDescriptor.Guid) { Configurations = Enumerable.Empty <TableConfiguration>() }; tableDescriptor.PrebuiltTableConfigurations = tableConfigurations; } } // combine these new tables with any existing requested tables for this processor this.RequestedTables = this.RequestedTables.Concat(postProcessTables.DataDerivedTables); } }
public CommandWrappedForCancel(IDbCommand command, IProcessingDataExtensionConnection dataExtensionConnection, IProcessingDataSource dataSourceObj, DataSourceInfo dataSourceInfo, string datasetName, IDbConnection connection) { this.m_command = command; this.m_dataExtensionConnection = dataExtensionConnection; this.m_dataSourceObj = dataSourceObj; this.m_dataSourceInfo = dataSourceInfo; this.m_datasetName = datasetName; this.m_connection = connection; }
private void ProcessSelects(DataSourceInfo dataSource, long userId, DslFormatBlock firstFormatBlock) { foreach (var selectItem in firstFormatBlock.Selects) { var selectItemProperty = _queryVariableNameBuilder.Decode(selectItem.Value); ProcessSelectItem(dataSource, userId, selectItem, selectItemProperty); } }
public void DeleteDataSource(DataSourceInfo dataSourceInfo) { if (Report != null) { var dataSource = Report.Dictionary.DataSources.FindByName(dataSourceInfo.Name); RemoveCollectionItem(Report.Dictionary.DataSources, dataSource); RefreshReport(); } }
internal CommandWrappedForCancel(IDbCommand command, IProcessingDataExtensionConnection dataExtensionConnection, IProcessingDataSource dataSourceObj, DataSourceInfo dataSourceInfo, string datasetName, IDbConnection connection) { m_command = command; m_dataExtensionConnection = dataExtensionConnection; m_dataSourceObj = dataSourceObj; m_dataSourceInfo = dataSourceInfo; m_datasetName = datasetName; m_connection = connection; }
/// <summary> /// Creates the configuration to be used by the ResourceStaticAnalysis. /// </summary> /// <returns>EngineConfig.</returns> protected override EngineConfig CreateEngineConfig(IEnumerable <RuleContainer> ruleContainers) { EngineConfig configuration = new EngineConfig(); //DataSourceProviderTypes configuration.AddDataSourceProvider(typeof(ResourceFileDataSource)); configuration.AddDataSourceProvider <ConfigDictionaryDataSource>(); //PropertyAdapterTypes configuration.AddPropertyAdapter(typeof(ResourceFileEntryPropertyAdapter)); configuration.AddPropertyAdapter <ConfigDictPropertyAdapter>(); configuration.AddPropertyAdapter <LocResourceSelfPropertyAdapter>(); //COAdatpers configuration.AddCOAdapter(typeof(ResourceFileDataAdapter)); //COTypes configuration.AddClassificationObject <LocResource>(); // Create a package var package = new DataSourcePackage(); // Set the type of CO that the package provides package.SetCOType <LocResource>(); // Create a data source to be part of the package var dataSource = new DataSourceInfo(); // Set the type of data source dataSource.SetSourceType(typeof(ResourceFile)); // Add data source to the package package.AddDataSource(dataSource); // Create another data source dataSource = new DataSourceInfo(); // Set type to be a ConfigDictionary - some custom object dataSource.SetSourceType <ConfigDictionary>(); // Create an instance of the ConfigDictionary object var staticProperties = new ConfigDictionary { { "Project", projectName } }; // Set the location. in this case the loaction is the object itself dataSource.SetSourceLocation(staticProperties); // Add data source to package package.AddDataSource(dataSource); // Add the package to the configuration configuration.AddDataSourcePackage(package); // Add the rules if (ruleContainers != null) { ruleContainers.ToList().ForEach(r => configuration.AddRule(r)); } return(configuration); }
private void ReadDataSource(string file) { // look for file-type foreach (FileType type in fileTypes) { if (type.IsFileType(file)) { fType = type; break; } } if (fType == null) { throw new Exception(String.Format("Unable to match file type for {0}", fType)); } // load data-source reader = new GDALReader(); reader.OpenFile(file, fType); // build source layers for UI dsInfo = reader.Info; DataSourceControl.DataSourcePreviewInfo info = new DataSourceControl.DataSourcePreviewInfo(); info.Dimensions = dsInfo.Resolution; info.Type = fType.Name; info.DataType = dsInfo.BppType; info.Groups = new DataSourceControl.DataSourceImageGroup[2]; DataSourceControl.DataSourcePreviewImage[] images = new DataSourceControl.DataSourcePreviewImage[dsInfo.Bands.Length]; for (int i = 0; i < dsInfo.Bands.Length; i++) { images[i] = new DataSourceControl.DataSourcePreviewImage(dsInfo.Bands[i].Image, dsInfo.Bands[i].Name, new Size(64, 64)); } DataSourceControl.DataSourcePreviewImage[] buildInImages = new DataSourceControl.DataSourcePreviewImage[2]; buildInImages[0] = new DataSourceControl.DataSourcePreviewImage(null, "NormalMap", new Size(64, 64)); buildInImages[1] = new DataSourceControl.DataSourcePreviewImage(/*Image.FromFile(file)*/ null, "TextureMap", new Size(64, 64)); info.Groups[1] = new DataSourceControl.DataSourceImageGroup(images); info.Groups[0] = new DataSourceControl.DataSourceImageGroup(buildInImages); dataSourceControl1.DataSource = info; // load profiles for data-type List <DataProfile> profiles = new List <DataProfile>(); foreach (DataProfile profile in dataProfiles) { if (profile.MatchProfile(fType)) { profiles.Add(profile); } } compatibleProfiles = profiles.ToArray(); dataProfileControl1.Profiles = compatibleProfiles; }
public async Task TestGetDatabases_Filter_NoMatch() { DataSourceInfo dsi = new DataSourceInfo(); dsi.ConnectionString = ConnectionString; IDataSource ds = DataSourceFactory.Create(dsi); var databases = await ds.GetDatabases("²»¿ÉÄÜÆ¥Åä"); Assert.AreEqual(0, databases.Count); }
protected virtual void OpenInitialConnectionAndTransaction() { if (this.m_dataSource.Transaction && this.m_mergeTran) { AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.DataSourceInfo dataSourceInfo = this.m_odpContext.GlobalDataSourceInfo[this.m_dataSource.Name]; if (dataSourceInfo != null) { this.m_connection = dataSourceInfo.Connection; this.m_transaction = dataSourceInfo.TransactionInfo; } } Global.Tracer.Trace(TraceLevel.Verbose, "Data source '{0}': Transaction = {1}, MergeTran = {2}, NumDataSets = {3}", this.m_dataSource.Name.MarkAsModelInfo(), this.m_dataSource.Transaction, this.m_mergeTran, this.m_runtimeDataSets.Count); if (this.m_connection == null) { AspNetCore.ReportingServices.ReportIntermediateFormat.DataSet dataSet = this.m_runtimeDataSets[0].DataSet; this.m_connection = RuntimeDataSource.OpenConnection(this.m_dataSource, dataSet, this.m_odpContext, this.m_executionMetrics); this.m_needToCloseConnection = true; Global.Tracer.Trace(TraceLevel.Verbose, "Data source '{0}': Created a connection.", this.m_dataSource.Name.MarkAsModelInfo()); } bool flag = false; if (this.m_dataSource.Transaction) { if (this.m_transaction == null) { IDbTransaction transaction = this.m_connection.BeginTransaction(); Global.Tracer.Trace(TraceLevel.Verbose, "Data source '{0}': Begun a transaction.", this.m_dataSource.Name.MarkAsModelInfo()); this.m_transaction = new AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.TransactionInfo(transaction); this.m_isTransactionOwner = true; } IDbTransactionExtension dbTransactionExtension = this.m_transaction.Transaction as IDbTransactionExtension; flag = (dbTransactionExtension != null && dbTransactionExtension.AllowMultiConnection); this.m_useConcurrentDataSetProcessing &= flag; Global.Tracer.Trace(TraceLevel.Verbose, "Data source '{0}': TransactionCanSpanConnections = {1}, ConcurrentDataSets = {2}", this.m_dataSource.Name.MarkAsModelInfo(), flag, this.m_useConcurrentDataSetProcessing); } this.MergeAutoCollationSettings(this.m_connection); if (this.m_isTransactionOwner && this.m_report.SubReportMergeTransactions && !this.m_odpContext.ProcessReportParameters) { IDbConnection connection; if (flag) { connection = null; this.m_isGlobalConnection = false; } else { connection = this.m_connection; this.m_isGlobalConnection = true; } Global.Tracer.Trace(TraceLevel.Verbose, "Data source '{0}': Storing trans+conn into GlobalDataSourceInfo. CloseConnection = {1}.", this.m_dataSource.Name.MarkAsModelInfo(), this.m_needToCloseConnection); DataSourceInfo dataSourceInfo2 = RuntimeDataSource.GetDataSourceInfo(this.m_dataSource, this.m_odpContext); this.m_odpContext.GlobalDataSourceInfo.Add(this.m_dataSource, connection, this.m_transaction, dataSourceInfo2); this.m_isGlobalTransaction = true; } }
private async void Savebtn_Click(object sender, RoutedEventArgs e) { _dataSourceInfo.DSType = sourceTypeCB.SelectedIndex + 1; DataSourceInfo model = await CommonRepo.PostDataSourceInfo(_dataSourceInfo); if (DataSourceInfoEventHandler != null) { DataSourceInfoEventHandler(this, model); } this.Close(); }
private bool OnRestFinish() { if (_restDataSourceView.ValidateChildren()) { DataSourceInfo = _restDataSourceView.DataSourceInfo; return(true); } return(false); }
private bool OnMsSqlFinish() { if (_msSqlDataSourceView.ValidateChildren()) { DataSourceInfo = _msSqlDataSourceView.DataSourceInfo; return(true); } return(false); }
private bool OnFirebirdFinish() { if (_firebirdDataSourceView.ValidateChildren()) { DataSourceInfo = _firebirdDataSourceView.DataSourceInfo; return(true); } return(false); }
private void UpdateDataGridView(DataSourceInfo dsInfo) { dgvResults.Columns.Clear(); if (dsInfo != null) { SuspendDrawing(dgvResults); foreach (DataFieldAttribute attr in dsInfo.Attributes) { string fieldName = attr.Name == "_geom_" ? "geom" : attr.Name; DataGridViewColumn clm = new DataGridViewColumn(); clm.CellTemplate = new DataGridViewTextBoxCell(); clm.DataPropertyName = fieldName; clm.ValueType =attr.Name == "_geom_" ? typeof(string): attr.DataType; clm.HeaderText = fieldName; dgvResults.Columns.Add(clm); } ResumeDrawing(dgvResults); } }