当前位置: 首页>>代码示例>>C#>>正文


C# IDataRecord.GetName方法代码示例

本文整理汇总了C#中IDataRecord.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# IDataRecord.GetName方法的具体用法?C# IDataRecord.GetName怎么用?C# IDataRecord.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataRecord的用法示例。


在下文中一共展示了IDataRecord.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataRecordMemberNode

 public DataRecordMemberNode(ObjectNode parent, Type[] types, IDataRecord r, int maxDepth, DataContextDriver dcDriver) : base(parent, r, maxDepth, dcDriver)
 {
     if (base.IsAtNestingLimit())
     {
         base.GraphTruncated = true;
     }
     else
     {
         for (int i = 0; i < r.FieldCount; i++)
         {
             object item = r.GetValue(i);
             Type type = null;
             if (types != null)
             {
                 type = types[i];
             }
             else if (item != null)
             {
                 type = item.GetType();
             }
             if (!(item is IDataRecord))
             {
             }
             base.Members.Add(new MemberData(r.GetName(i), type, ObjectNode.Create(this, item, maxDepth, base.DCDriver)));
         }
         if ((base.Members.Count > 50) && (base.NestingDepth > 1))
         {
             base.InitiallyHidden = true;
         }
     }
 }
开发者ID:CuneytKukrer,项目名称:TestProject,代码行数:31,代码来源:DataRecordMemberNode.cs

示例2: Populate

        public static Object Populate( IDataRecord rd, ObjectInfo state )
        {
            IEntity obj = Entity.New( state.EntityInfo.Type.FullName );
            // state
            //obj.state.Order = state.Order;

            for (int i = 0; i < rd.FieldCount; i++) {

                Object fdvalue = rd[i];

                if (fdvalue == null || fdvalue == DBNull.Value) continue;

                EntityPropertyInfo ep = state.EntityInfo.GetPropertyByColumn( rd.GetName( i ) );
                if (ep == null) continue;

                try {
                    if (ep.IsEntity || ep.IsAbstractEntity) {
                        setEntityPropertyValueById( obj, state, ep, rd.GetInt32( i ) );
                    }
                    else {
                        ep.SetValue( obj, getReaderValue( fdvalue, ep.Type ) );
                    }

                }
                catch (Exception ex) {
                    logger.Error( ex.Message + "=" + ep.Name + "_" + ep.Type );
                    logger.Error( ex.StackTrace );
                    throw ex;
                }

            }

            return obj;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:34,代码来源:FillUtil.cs

示例3: Answer

        /// <exception cref="AggregateException">Condition.</exception>
        public Answer(IDataRecord record)
        {
            IList<Exception> exceptions = null;
            var sc = StringComparer.OrdinalIgnoreCase;
            for (var i = 0; i < record.FieldCount; i++)
            {
                try
                {
                    var name = record.GetName(i);
                    if (sc.Equals(name, "AnswerID") || sc.Equals(name, "ID"))
                        AnswerID = record.GetInt32(i);
                    else if (sc.Equals(name, "QuestionID"))
                        QuestionID = record.GetInt32(i);
                    else if (sc.Equals(name, "Text"))
                        Text = record.GetString(i);
                    else if (sc.Equals(name, "Correct"))
                        Correct = record.GetBoolean(i);
                }
                catch (Exception ex)
                {
                    (exceptions ?? (exceptions = new List<Exception>(1))).Add(ex);
                }
            }

            if (exceptions != null && exceptions.Count > 0)
                throw new AggregateException("One or more errors occurred loading the " + typeof(Answer).FullName + " object from "
                                             + typeof(IDataRecord).FullName + ".", exceptions);
        }
开发者ID:zeldafreak,项目名称:Area51,代码行数:29,代码来源:Answer.cs

示例4: Getcolumns

 private static IEnumerable<string> Getcolumns(IDataRecord reader)
 {
     for (var ii=0; ii<reader.FieldCount; ii++)
     {
         yield return reader.GetName(ii);
     }
 }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:7,代码来源:DynamicSqlQuery.cs

示例5: DigitalContentRow

        public DigitalContentRow(IDataRecord reader)
        {
            ContentUid = Guid.Empty;
            Url = String.Empty;
            OriginalId = String.Empty;
            ItemUid = Guid.Empty;

            for (int i = 0; i < reader.FieldCount; i++)
            {
                switch (reader.GetName(i))
                {
                    case "ContentUid":
                        ContentUid = (Guid)reader["ContentUid"];
                        Url = Helpers.GetDigitalContentUrl(ContentUid);
                        break;
                    case "Url":
                        Url = (string)reader["Url"];
                        break;
                    case "OriginalId":
                        OriginalId = (string)reader["OriginalId"];
                        ItemUid = new Guid(OriginalId.Substring(0, 36));
                        break;
                    case "ItemUid":
                        ItemUid = (Guid)reader["ItemUid"];
                        break;
                }
            }
        }
开发者ID:katerina-marchenkova,项目名称:my,代码行数:28,代码来源:DigitalContentRow.cs

示例6: DbRecord

 public DbRecord(IDataRecord record) {
    Length = record.FieldCount;
    Names = new Dictionary<string, int>();
    for (var i = 0; i < Length; i++) {
       Names.Add(record.GetName(i), i);
    }
    Values = new object[Length];
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:8,代码来源:DbRecord.cs

示例7: LoadFromRecord

 private void LoadFromRecord(IDataRecord record)
 {
     _dataRecord = record;
     for (var i = 0; i < record.FieldCount; i++)
     {
         _items.Add(i, record.GetValue(i));
         _names.Add(record.GetName(i));
     }
 }
开发者ID:marinoscar,项目名称:Luval,代码行数:9,代码来源:DataRecord.cs

示例8: DynamicTableContentModel

		public DynamicTableContentModel(IDataRecord record)
		{
			DataHolder = new Dictionary<string, object>();

			for (int i = 0; i < record.FieldCount; i++)
			{
				DataHolder.Add(record.GetName(i), record.GetValue(i));
			}
		}
开发者ID:JPVenson,项目名称:DataAccess,代码行数:9,代码来源:DynamicTableContentModel.cs

示例9: HasColumn

 private bool HasColumn(IDataRecord dr, string columnName)
 {
     for (int i = 0; i < dr.FieldCount; i++)
     {
         if (dr.GetName(i).Equals(columnName, StringComparison.InvariantCultureIgnoreCase))
             return true;
     }
     return false;
 }
开发者ID:hohogpb,项目名称:BookmarksManager,代码行数:9,代码来源:DynamicDataReader.cs

示例10: FieldNameLookup

        public FieldNameLookup(IDataRecord reader, int defaultLocaleID) { // V1.2.3300

            int length = reader.FieldCount;
            string[] fieldNames = new string[length];
            for (int i = 0; i < length; ++i) {
                fieldNames[i] = reader.GetName(i);
                Debug.Assert(null != fieldNames[i], "MDAC 66681");
            }
            _fieldNames = fieldNames;
            _defaultLocaleID = defaultLocaleID;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:11,代码来源:FieldNameLookup.cs

示例11: DataRecordConverterSpec

		public DataRecordConverterSpec(IDataRecord dataRecord, Type recordType)
		{
			var fields = new List<DataRecordFieldInfo>(dataRecord.FieldCount);
			for (int index = 0; index < dataRecord.FieldCount; ++index)
			{
				fields.Add(new DataRecordFieldInfo(index, dataRecord.GetName(index), dataRecord.GetFieldType(index)));
			}

			_recordType = recordType;
			_fields = fields.AsReadOnly();
		}
开发者ID:matthewc-mps-aust,项目名称:quokka,代码行数:11,代码来源:DataRecordConverterSpec.cs

示例12: CreateBuilder

        private static Build CreateBuilder(Type destinationType, IDataRecord dataRecord)
        {
            var method = new DynamicMethod("DynamicCreate", destinationType, new[] { typeof(IDataRecord) }, destinationType, true);
            var generator = method.GetILGenerator();

            var result = generator.DeclareLocal(destinationType);
            generator.Emit(OpCodes.Newobj, destinationType.GetConstructor(Type.EmptyTypes));
            generator.Emit(OpCodes.Stloc, result);

            for (var i = 0; i < dataRecord.FieldCount; i++)
            {
                var propertyInfo = destinationType.GetProperty(dataRecord.GetName(i));
                var endIfLabel = generator.DefineLabel();

                if (propertyInfo != null && propertyInfo.GetSetMethod(true) != null)
                {
                    generator.Emit(OpCodes.Ldarg_0);
                    generator.Emit(OpCodes.Ldc_I4, i);
                    generator.Emit(OpCodes.Callvirt, isDBNullMethod);
                    generator.Emit(OpCodes.Brtrue, endIfLabel);

                    generator.Emit(OpCodes.Ldloc, result);
                    generator.Emit(OpCodes.Ldarg_0);
                    generator.Emit(OpCodes.Ldc_I4, i);
                    generator.Emit(OpCodes.Callvirt, getValueMethod);

                    if (propertyInfo.PropertyType.IsGenericType
                        && propertyInfo.PropertyType.GetGenericTypeDefinition().Equals(typeof(Nullable<>))
                        )
                    {
                        var nullableType = propertyInfo.PropertyType.GetGenericTypeDefinition().GetGenericArguments()[0];
                        if (!nullableType.IsEnum)
                            generator.Emit(OpCodes.Unbox_Any, propertyInfo.PropertyType);
                        else
                        {
                            generator.Emit(OpCodes.Unbox_Any, nullableType);
                            generator.Emit(OpCodes.Newobj, propertyInfo.PropertyType);
                        }
                    }
                    else
                    {
                        generator.Emit(OpCodes.Unbox_Any, dataRecord.GetFieldType(i));
                    }
                    generator.Emit(OpCodes.Callvirt, propertyInfo.GetSetMethod(true));

                    generator.MarkLabel(endIfLabel);
                }
            }

            generator.Emit(OpCodes.Ldloc, result);
            generator.Emit(OpCodes.Ret);

            return (Build)method.CreateDelegate(typeof(Build));
        }
开发者ID:ewilde,项目名称:AutoMapper,代码行数:54,代码来源:DataReaderMapper.cs

示例13: Execute

        /// <summary>
        /// Executes the selector and returns a dictionary containing the column names and their ordinals.
        /// </summary>
        /// <param name="dataRecord">The <see cref="IDataRecord"/> that represents the available fields/columns.</param>
        /// <returns>A dictionary containing the column names and their ordinals.</returns>
        public IDictionary<string, int> Execute(IDataRecord dataRecord)
        {
            IDictionary<string, int> result = new Dictionary<string, int>(dataRecord.FieldCount, StringComparer.InvariantCultureIgnoreCase);

            for (int i = 0; i < dataRecord.FieldCount; i++)
            {
                result.Add(dataRecord.GetName(i), i);
            }

            return result;
        }
开发者ID:seesharper,项目名称:DbExtensions,代码行数:16,代码来源:ColumnSelector.cs

示例14: FieldNameLookup

 public FieldNameLookup(IDataRecord reader, int defaultLocaleID)
 {
     int fieldCount = reader.FieldCount;
     string[] strArray = new string[fieldCount];
     for (int i = 0; i < fieldCount; i++)
     {
         strArray[i] = reader.GetName(i);
     }
     this._fieldNames = strArray;
     this._defaultLocaleID = defaultLocaleID;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:FieldNameLookup.cs

示例15: CreateResult

 private static QueryResult CreateResult(IDataRecord reader)
 {
     var result = new QueryResult();
     for (var ii = 0; ii < reader.FieldCount; ii++)
     {
         var name = reader.GetName(ii);
         var type = reader.GetFieldType(ii);
         result.AddColumn(name, type);
     }
     return result;
 }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:11,代码来源:SqlExecutor.cs


注:本文中的IDataRecord.GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。