System.Data.Common.DbDataReader.GetName(int)

Here are the examples of the csharp api class System.Data.Common.DbDataReader.GetName(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

53 Examples 7

51. Example

Project: Glimpse
Source File: GlimpseDbDataReader.cs
public override string GetName(int ordinal)
        {
            return InnerDataReader.GetName(ordinal);
        }

52. Example

Project: ALinq
Source File: ObjectReaderCompiler.IObjectReaderSession.cs
internal string[] GetActiveNames()
            {
                var strArray = new string[DataReader.FieldCount];
                int index = 0;
                int fieldCount = DataReader.FieldCount;
                while (index < fieldCount)
                {
                    strArray[index] = DataReader.GetName(index);
                    index++;
                }
                return strArray;
            }

53. Example

Project: ALinq
Source File: ObjectReaderCompiler.Rereader.cs
public override string GetName(int i)
            {
                if (names != null)
                {
                    return names[i];
                }
                return reader.GetName(i);
            }

54. Example

Project: ALinq
Source File: AccessDbConnection.cs
public override string GetName(int ordinal)
        {
            return source.GetName(ordinal);
        }

55. Example

Project: ALinq
Source File: DataReader.cs
public override string GetName(int ordinal)
        {
            return source.GetName(ordinal);
        }

56. Example

Project: ALinq
Source File: Connection.cs
public override string GetName(int ordinal)
        {
            return source.GetName(ordinal);
        }

57. Example

Project: ALinq
Source File: Connection.cs
public override string GetName(int ordinal)
        {
            return source.GetName(ordinal);
        }

58. Example

Project: nhibernate-core
Source File: ResultSetWrapper.cs
public override string GetName(int i)
		{
			return rs.GetName(i);
		}

59. Example

Project: nhibernate-core
Source File: BasicResultSetsCommand.cs
public override string GetName(int i)
		{
			return reader.GetName(i);
		}

60. Example

Project: nhibernate-core
Source File: NHybridDataReader.cs
public override string GetName(int i)
		{
			return _reader.GetName(i);
		}

61. Example

Project: nhibernate-core
Source File: CustomLoader.cs
public string GetColumnName(int position)
			{
				return resultSet.GetName(position);
			}

62. Example

Project: NServiceKit
Source File: ProfiledDbDataReader.cs
public override string GetName(int ordinal)
        {
            return _reader.GetName(ordinal);
        }

63. Example

Project: nuodb-dotnet
Source File: NuoDbMultipleCommands.cs
public override string GetName(int ordinal)
        {
            return wrappedReader.GetName(ordinal);
        }

64. Example

Project: OrionSDK
Source File: InformationServiceDataReader.cs
public override string GetName(int ordinal)
        {
            return _resultsReader.GetName(ordinal);
        }

65. Example

Project: effort
Source File: DataReaderInspectorDataReader.cs
public override string GetName(int ordinal)
        {
            return this.wrappedDataReader.GetName(ordinal);
        }

66. Example

Project: ALinq
Source File: ObjectReaderCompiler.ObjectReaderBase.cs
private int[] GetColumnOrdinals(NamedColumn[] namedColumns)
            {
                DbDataRead/n ..... /n //View Source file for more details /n }

67. Example

Project: nhibernate-core
Source File: IdentifierGeneratorFactory.cs
public static object Get(DbDataReader rs, IType type, ISessionImplementor session)
		{
			// here is an interesting one: 
			// - MsSql's @@identity returns a Decimal
			// - MySql LAST_IDENITY() returns an Int64 			
			try
			{
				return type.NullSafeGet(rs, rs.GetName(0), session, null);
			}
			catch (Exception e)
			{
				throw new IdentifierGenerationException("could not retrieve identifier value", e);
			}
		}

68. Example

Project: SharpMap
Source File: PostGIS.cs
private FeatureDataTable CreateTableFromReader(DbDataReader reader, int geomIndex)
        {
            var res = new FeatureDataTable { TableName = Table };
            for (var c = 0; c < geomIndex; c++)
            {
                var fieldType = reader.GetFieldType(c);
                if (fieldType == null)
                    throw new Exception("Unable to retrieve field type for column " + c);
                res.Columns.Add(reader.GetName(c), fieldType);
            }
            return res;
        }

69. Example

Project: framework
Source File: FieldReader.cs
internal FieldReaderException CreateFieldReaderException(Exception ex)
        {
            return new FieldReaderException(ex)
            {
                Ordinal = LastOrdinal,
                ColumnName = reader.GetName(LastOrdinal),
                ColumnType = reader.GetFieldType(LastOrdinal),
            };
        }

70. Example

Project: Lidarr
Source File: MappingHelper.cs
public T LoadSimpleValueFromFirstColumn<T>(DbDataReader reader)
        {
            try
            {
                return (T)reader.GetValue(0);
            }
            catch (Exception ex)
            {
                string firstColumnName = reader.GetName(0);
                string msg = string.Format("The DataMapper was unable to create a value of type '{0}' from the first column '{1}'.",
                    typeof(T).Name, firstColumnName);

                throw new DataMappingException(msg, ex);
            }
        }

71. Example

Project: LimeBean
Source File: DatabaseAccess.cs
static IDictionary<string, object> RecordToDict(DbDataReader reader) {
            var count = reader.FieldCount;
            var result = new Dictionary<string, object>();

            for(var i = 0; i < count; i++)
                result[reader.GetName(i)] = StripDbNull(reader.GetValue(i));

            return result;
        }

72. Example

Project: Radarr
Source File: MappingHelper.cs
public T LoadSimpleValueFromFirstColumn<T>(DbDataReader reader)
        {
            try
            {
                return (T)reader.GetValue(0);
            }
            catch (Exception ex)
            {
                string firstColumnName = reader.GetName(0);
                string msg = string.Format("The DataMapper was unable to create a value of type '{0}' from the first column '{1}'.",
                    typeof(T).Name, firstColumnName);

                throw new DataMappingException(msg, ex);
            }
        }

73. Example

Project: SharpMap
Source File: ManagedSpatiaLite.cs
private FeatureDataTable CreateTableFromReader(DbDataReader reader, int geomIndex)
        {
            var res = new FeatureDataTable {TableName = Table};
            for (var c = 0; c < geomIndex; c++)
            {
                var fieldType = reader.GetFieldType(c);
                if (fieldType == null)
                    throw new Exception("Unable to retrieve field type for column " + c);
                res.Columns.Add(DequoteIdentifier(reader.GetName(c)), fieldType);
            }
            return res;
        }

74. Example

Project: SmartStoreNET
Source File: CachingCommand.cs
private static ColumnMetadata[] GetTableMetadata(DbDataReader reader)
		{
			var columnMetadata = new ColumnMetadata[reader.FieldCount];

			for (var i = 0; i < reader.FieldCount; i++)
			{
				columnMetadata[i] = new ColumnMetadata
				{
					Name = reader.GetName(i),
					DataTypeName = reader.GetDataTypeName(i),
					DataType = reader.GetFieldType(i)
				};
			}

			return columnMetadata;
		}

75. Example

Project: Sonarr
Source File: MappingHelper.cs
public T LoadSimpleValueFromFirstColumn<T>(DbDataReader reader)
        {
            try
            {
                return (T)reader.GetValue(0);
            }
            catch (Exception ex)
            {
                string firstColumnName = reader.GetName(0);
                string msg = string.Format("The DataMapper was unable to create a value of type '{0}' from the first column '{1}'.",
                    typeof(T).Name, firstColumnName);

                throw new DataMappingException(msg, ex);
            }
        }

76. Example

Project: RiotControl
Source File: DatabaseReader.cs
public void Dump(string description)
		{
			Console.WriteLine("{0}:\n", description);
			for (int i = 0; i < DataReader.FieldCount; i++)
			{
				object target = DataReader[i];
				Console.WriteLine("[{0} {1}] {2}: {3}", i, DataReader.GetName(i), target.GetType(), target);
			}
		}

77. Example

Project: Craig-s-Utility-Library
Source File: DatabaseBatch.cs
private static IList<dynamic> GetValues(DbDataReader TempReader)
        {
            Contract.Requires<ArgumentNullException>(TempReader != null, "TempReader");
            var ReturnValue = new List<dynamic>();
            string[] FieldNames = new string[TempReader.FieldCount];
            for (int x = 0; x < TempReader.FieldCount; ++x)
            {
                FieldNames[x] = TempReader.GetName(x);
            }
            while (TempReader.Read())
            {
                var Value = new Dynamo();
                for (int x = 0; x < TempReader.FieldCount; ++x)
                {
                    Value.Add(FieldNames[x], TempReader[x]);
                }
                ReturnValue.Add(Value);
            }
            return ReturnValue;
        }

78. Example

Project: Craig-s-Utility-Library
Source File: DatabaseBatch.cs
private static IList<dynamic> GetValues(DbDataReader TempReader)
        {
            Contract.Requires<ArgumentNullException>(TempReader != null, "TempReader");
            var ReturnValue = new List<dynamic>();
            string[] FieldNames = new string[TempReader.FieldCount];
            for (int x = 0; x < TempReader.FieldCount; ++x)
            {
                FieldNames[x] = TempReader.GetName(x);
            }
            while (TempReader.Read())
            {
                var Value = new Dynamo();
                for (int x = 0; x < TempReader.FieldCount; ++x)
                {
                    Value.Add(FieldNames[x], TempReader[x]);
                }
                ReturnValue.Add(Value);
            }
            return ReturnValue;
        }

79. Example

Project: nhibernate-core
Source File: IdentifierGeneratorFactory.cs
public static async Task<object> GetAsync(DbDataReader rs, IType type, ISessionImplementor session, CancellationToken cancellationToken)
		{
			cancellationToken.ThrowIfCancellationRequested();
			// here is an interesting one: 
			// - MsSql's @@identity returns a Decimal
			// - MySql LAST_IDENITY() returns an Int64 			
			try
			{
				return await (type.NullSafeGetAsync(rs, rs.GetName(0), session, null, cancellationToken)).ConfigureAwait(false);
			}
			catch (Exception e)
			{
				throw new IdentifierGenerationException("could not retrieve identifier value", e);
			}
		}

80. Example

Project: linq2db
Source File: DataProviderBase.cs
public virtual Expression GetReaderExpression(MappingSchema mappingSchema, IDataReader reader, int i/n ..... /n //View Source file for more details /n }

81. Example

Project: Kalman.Studio
Source File: MapExt.cs
public static T ToObject<T>(this DbDataReader reader, string readerName, string[] excludeFields, ObjectsChangeTracker changeTracker)
		{
            ///???????????????????readerName???????????????
            if (string.IsNullOrEmpty(readerName))
            {
                var mappingKeyBuilder = new StringBuilder();
                for (int i = 0; i < reader.FieldCount; ++i)
                {
                    mappingKeyBuilder.Append(reader.GetName(i));
                    mappingKeyBuilder.Append('$');
                }
                readerName = mappingKeyBuilder.ToString().ToLower();
            }

			T result = new DataReaderToObjectMapper<T>(readerName, null, excludeFields).MapUsingState(reader, reader);
			if (changeTracker != null)
			{
				changeTracker.RegisterObject(result);
			}
			return result;
		}

82. Example

Project: Kalman.Studio
Source File: MapExt.cs
public static IEnumerable<T> ToObjects<T>(this DbDataReader reader, string readerName, string[] excludeFields, ObjectsChangeTracker changeTracker)
		{
			if (string.IsNullOrEmpty(readerName))
			{
				var mappingKeyBuilder = new StringBuilder();
				for (int i = 0; i < reader.FieldCount; ++i)
				{
					mappingKeyBuilder.Append(reader.GetName(i));
					mappingKeyBuilder.Append('$');
				}
				readerName = mappingKeyBuilder.ToString().ToLower();
			}
			return new DataReaderToObjectMapper<T>(readerName, null, excludeFields).ReadCollection(reader, changeTracker);
		}

83. Example

Project: MimeKit
Source File: X509CertificateDatabase.cs
X509CrlRecord LoadCrlRecord (DbDataReader reader, X509CrlParser parser, ref byte[] buffer)
		{
			var record = new X509CrlRecord ();

			for (int i = 0; i < reader.FieldCount; i++) {
				switch (reader.GetName (i).ToUpperInvariant ()) {
				case "CRL":
					record.Crl = DecodeX509Crl (reader, parser, i, ref buffer);
					break;
				case "THISUPDATE":
					record.ThisUpdate = DateTime.SpecifyKind (reader.GetDateTime (i), DateTimeKind.Utc);
					break;
				case "NEXTUPDATE":
					record.NextUpdate = DateTime.SpecifyKind (reader.GetDateTime (i), DateTimeKind.Utc);
					break;
				case "DELTA":
					record.IsDelta = reader.GetBoolean (i);
					break;
				case "ID":
					record.Id = reader.GetInt32 (i);
					break;
				}
			}

			return record;
		}

84. Example

Project: DotNetSiemensPLCToolBoxLibrary
Source File: MsSQLStorage.cs
public override void CreateOrModify_TablesAndFields(string dataTable, DatasetConfig datasetConfig)
 /n ..... /n //View Source file for more details /n }

85. Example

Project: DotNetSiemensPLCToolBoxLibrary
Source File: PostgreSQLStorage.cs
public override void CreateOrModify_TablesAndFields(string dataTable, DatasetConfig datasetConfig)
 /n ..... /n //View Source file for more details /n }

86. Example

Project: nuodb-dotnet
Source File: HelloDB.cs
public void AddNames()
        {
            try
            {
                using (DbCommand command = connection.CreateCommand())
                {
                    command.CommandText = "insert into names (name) values (?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?),(?)";
                    command.Prepare();

                    /* batch insert a set of names */
                    for (int i = 0; i < 15; i++) 
                    {
                        string name = String.Format("Fred # {0}", i+1);
                        command.Parameters[i].Value = name;
                    }
                    // This is how to retrieve the generated key. Even if it's an update statement, we request the DbReader, that will contain 
                    // only the generated column value
                    using (DbDataReader reader = command.ExecuteReader())
                    {
                        string columnName = reader.GetName(0);
                        while (reader.Read())
                        {
                            Console.Out.WriteLine("New id={0} for column {1}", reader.GetInt64(0), columnName);
                        }
                    }
                }
            }
            catch (NuoDbSqlException e)
            {
                throw e;
            }

        }

87. Example

Project: AntData.ORM
Source File: DataProviderBase.cs
public virtual Expression GetReaderExpression(MappingSchema mappingSchema, IDataReader reader, int i/n ..... /n //View Source file for more details /n }

88. Example

Project: Wexflow
Source File: SqlToXml.cs
private void ConvertToXml(DbConnection connection, DbCommand command)
        {
            connection.Open();
            var reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                var columns = new List<string>();

                for (int i = 0; i < reader.FieldCount; i++)
                {
                    columns.Add(reader.GetName(i));
                }

                string destPath = Path.Combine(Workflow.WorkflowTempFolder,
                                               string.Format("SqlToXml_{0:yyyy-MM-dd-HH-mm-ss-fff}.xml",
                                               DateTime.Now));
                var xdoc = new XDocument();
                var xobjects = new XElement("Records");

                while (reader.Read())
                {
                    var xobject = new XElement("Record");

                    foreach (var column in columns)
                    {
                        xobject.Add(new XElement("Cell"
                            , new XAttribute("column", SecurityElement.Escape(column))
                            , new XAttribute("value", SecurityElement.Escape(reader[column].ToString()))));
                    }
                    xobjects.Add(xobject);
                }
                xdoc.Add(xobjects);
                xdoc.Save(destPath);
                Files.Add(new FileInf(destPath, Id));
                InfoFormat("XML file generated: {0}", destPath);
            }
        }

89. Example

Project: nesper
Source File: PollExecStrategyDBQuery.cs
private IList<EventBean> Execute(DbDriverCommand driverCommand, Object[] lookupValuePerStream)/n ..... /n //View Source file for more details /n }

90. Example

Project: nesper
Source File: PollExecStrategyDBQuery.cs
private IList<EventBean> Execute(DbDriverCommand driverCommand, Object[] lookupValuePerStream)/n ..... /n //View Source file for more details /n }

91. Example

Project: MimeKit
Source File: X509CertificateDatabase.cs
X509CertificateRecord LoadCertificateRecord (DbDataReader reader, X509CertificateParser parser, ref byte[] buffer)
		{
			var record = new X509CertificateRecord ();

			for (int i = 0; i < reader.FieldCount; i++) {
				switch (reader.GetName (i).ToUpperInvariant ()) {
				case "CERTIFICATE":
					record.Certificate = DecodeCertificate (reader, parser, i, ref buffer);
					break;
				case "PRIVATEKEY":
					record.PrivateKey = DecodePrivateKey (reader, i, ref buffer);
					break;
				case "ALGORITHMS":
					record.Algorithms = DecodeEncryptionAlgorithms (reader, i);
					break;
				case "ALGORITHMSUPDATED":
					record.AlgorithmsUpdated = DateTime.SpecifyKind (reader.GetDateTime (i), DateTimeKind.Utc);
					break;
				case "TRUSTED":
					record.IsTrusted = reader.GetBoolean (i);
					break;
				case "ID":
					record.Id = reader.GetInt32 (i);
					break;
				}
			}

			return record;
		}

92. Example

Project: ExcelDna.Utilities
Source File: XLDBWrapper.cs
public static object[,] ToVariant(this DbDataReader reader, string[] properties=null, string[] colhe/n ..... /n //View Source file for more details /n }

93. Example

Project: PdfReport
Source File: GenericDataReaderDataSource.cs
public IEnumerable<IList<CellData>> Rows()
        {
            var factory = DbProvide/n ..... /n //View Source file for more details /n }

94. Example

Project: DotNetSiemensPLCToolBoxLibrary
Source File: MySQLStorage.cs
public override void CreateOrModify_TablesAndFields(string dataTable, DatasetConfig datasetConfig)
 /n ..... /n //View Source file for more details /n }

95. Example

Project: DotNetSiemensPLCToolBoxLibrary
Source File: SQLLiteStorage.cs
public override void CreateOrModify_TablesAndFields(string dataTable, DatasetConfig datasetConfig)
 /n ..... /n //View Source file for more details /n }

96. Example

Project: nhibernate-core
Source File: NDataReader.cs
internal static async Task<NResult> CreateAsync(DbDataReader reader, bool isMidstream, CancellationToken cancellationToken)
			{
				cancellationToken.ThrowIfCancellationRequested();
				var result = new NResult
				{
					schemaTable = reader.GetSchemaTable()
				};

				List<object[]> recordsList = new List<object[]>();
				int rowIndex = 0;

				// if we are in the middle of processing the reader then don't bother
				// to move to the next record - just use the current one.
				while (isMidstream || await (reader.ReadAsync(cancellationToken)).ConfigureAwait(false))
				{
					if (rowIndex == 0)
					{
						for (int i = 0; i < reader.FieldCount; i++)
						{
							string fieldName = reader.GetName(i);
							result.fieldNameToIndex[fieldName] = i;
							result.fieldIndexToName.Add(fieldName);
							result.fieldTypes.Add(reader.GetFieldType(i));
							result.fieldDataTypeNames.Add(reader.GetDataTypeName(i));
						}

						result.colCount = reader.FieldCount;
					}

					rowIndex++;

					object[] colValues = new object[reader.FieldCount];
					reader.GetValues(colValues);
					recordsList.Add(colValues);

					// we can go back to reading a reader like normal and don't need
					// to consider where we started from.
					isMidstream = false;
				}

				result.records = recordsList.ToArray();
				return result;
			}

97. Example

Project: nhibernate-core
Source File: NDataReader.cs
internal static NResult Create(DbDataReader reader, bool isMidstream)
			{
				var result = new NResult
				{
					schemaTable = reader.GetSchemaTable()
				};

				List<object[]> recordsList = new List<object[]>();
				int rowIndex = 0;

				// if we are in the middle of processing the reader then don't bother
				// to move to the next record - just use the current one.
				while (isMidstream || reader.Read())
				{
					if (rowIndex == 0)
					{
						for (int i = 0; i < reader.FieldCount; i++)
						{
							string fieldName = reader.GetName(i);
							result.fieldNameToIndex[fieldName] = i;
							result.fieldIndexToName.Add(fieldName);
							result.fieldTypes.Add(reader.GetFieldType(i));
							result.fieldDataTypeNames.Add(reader.GetDataTypeName(i));
						}

						result.colCount = reader.FieldCount;
					}

					rowIndex++;

					object[] colValues = new object[reader.FieldCount];
					reader.GetValues(colValues);
					recordsList.Add(colValues);

					// we can go back to reading a reader like normal and don't need
					// to consider where we started from.
					isMidstream = false;
				}

				result.records = recordsList.ToArray();
				return result;
			}

98. Example

Project: Wexflow
Source File: SqlToCsv.cs
private void ConvertToCsv(DbConnection conn, DbCommand comm)
        {
            conn.Open();
            var reader = comm.ExecuteReader();

            if (reader.HasRows)
            {
                var columns = new List<string>();
                StringBuilder builder = new StringBuilder();

                for (int i = 0; i < reader.FieldCount; i++)
                {
                    columns.Add(reader.GetName(i));
                    builder.Append(reader.GetName(i)).Append(Separator);
                }

                builder.Append("\r\n");
                string destPath = Path.Combine(Workflow.WorkflowTempFolder,
                                               string.Format("SqlToCsv_{0:yyyy-MM-dd-HH-mm-ss-fff}.csv",
                                               DateTime.Now));

                while (reader.Read())
                {
                    foreach (var column in columns)
                    {
                        builder.Append(reader[column]).Append(Separator);
                    }
                    builder.Append("\r\n");
                }

                File.WriteAllText(destPath, builder.ToString());
                Files.Add(new FileInf(destPath, Id));
                InfoFormat("CSV file generated: {0}", destPath);
            }
        }

99. Example

Project: MedallionOData
Source File: DefaultSqlExecutor.cs
protected internal virtual IEnumerable MaterializeReader(DbDataReader reader, Type resultType)
     /n ..... /n //View Source file for more details /n }

100. Example

Project: flabbergast
Source File: sql.cs
protected override Frame ComputeResult()
        {
            var command = connection.CreateComman/n ..... /n //View Source file for more details /n }