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


C# SafeDataReader.GetSafeString方法代码示例

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


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

示例1: ReadFields

        /// <summary>
        /// Reads fields.
        /// </summary>
        /// <param name="process">The process.</param>
        /// <param name="sr">The reader.</param>
        private void ReadFields(ProcessEditDto process, SafeDataReader sr)
        {
            sr.NextResult();

            int? sectionId = null;
            SectionDto section = null;
            var times = new List<double>();

            while (sr.Read())
            {
                var start = DateTime.Now;
                var fieldDto = new FieldDto
                {
                    Id = sr.GetInt32(0),
                    Name = sr.GetSafeString(1, string.Empty).Replace(@"""", "''"),
                    FieldTypeId = sr.GetInt32(2),
                    SectionId = sr.GetInt32(3),
                    Width = sr.GetDouble(4),
                    RowSpan = sr.GetInt(5),
                    ShowInList = sr.GetBoolean(6),
                    IncludeInFilter = sr.GetBoolean(7),
                    HideFromDetails = sr.GetBoolean(8),
                    SystemName = sr.GetString(9),
                    Position = sr.GetInt32(10),
                    CopyFieldValueOnCopyItem = sr.GetBool(11),
                    DeepCopy = sr.GetBool(12),
                    Guid = sr.GetGuid(13),
                    SearchPosition = sr.GetInt(14),
                    SearchWidth = sr.GetInt(15),
                    IsBase = sr.GetBoolean(16),
                    UseInGlobalSearch = sr.GetBoolean(19),
                    PublishedCopyId = sr.GetNullableInt(21),
                    AllowLocalizedData = sr.GetBoolean("AllowLocalizedData")
                };

                if (fieldDto.SectionId != sectionId || section == null)
                {
                    section = process.Sections.First(s => s.Id == fieldDto.SectionId);
                    sectionId = fieldDto.SectionId;
                }

                fieldDto.FieldTypeInfo = new FieldTypeDto
                {
                    Id = fieldDto.FieldTypeId,
                    Name = sr.GetString(17),
                    DataType = sr.GetString(18),
                    CanBeRequired = sr.GetBoolean(20)
                };

                section.FieldList.Add(fieldDto);

                times.Add((DateTime.Now - start).TotalMilliseconds);
            }

            Profiler.Profile(() => this.ReadFieldEditors(process, sr));
        }
开发者ID:mparsin,项目名称:Elements,代码行数:61,代码来源:ProcessDAL2.cs


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