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


C# MemberInfo.GetMemberInfoType方法代码示例

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


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

示例1: GetToDbConverter

 public virtual Func<object, object> GetToDbConverter(Type destType, MemberInfo sourceMemberInfo)
 {
     var type = sourceMemberInfo.GetMemberInfoType();
     return sourceMemberInfo != null ? GetToDbConverter(destType, type) : null;
 }
开发者ID:umerlone,项目名称:frapid,代码行数:5,代码来源:DefaultMapper.cs

示例2: GetFromDbConverter

 public virtual Func<object, object> GetFromDbConverter(MemberInfo destMemberInfo, Type sourceType)
 {
     var type = destMemberInfo.GetMemberInfoType();
     return destMemberInfo != null ? GetFromDbConverter(type, sourceType) : null;
 }
开发者ID:umerlone,项目名称:frapid,代码行数:5,代码来源:DefaultMapper.cs

示例3: IsList

 public static bool IsList(MemberInfo mi)
 {
     return mi.GetMemberInfoType().IsOfGenericType(typeof(IList<>)) && !mi.GetMemberInfoType().IsArray;
 }
开发者ID:schotime,项目名称:NPoco,代码行数:4,代码来源:PocoDataBuilder.cs

示例4: FromMemberInfo

        public static ColumnInfo FromMemberInfo(MemberInfo mi)
        {
            var ci = new ColumnInfo{MemberInfo = mi};
            var attrs = ReflectionUtils.GetCustomAttributes(mi);
            var colAttrs = attrs.OfType<ColumnAttribute>();
            var columnTypeAttrs = attrs.OfType<ColumnTypeAttribute>();
            var ignoreAttrs = attrs.OfType<IgnoreAttribute>();
            var complexMapping = attrs.OfType<ComplexMappingAttribute>();
            var serializedColumnAttributes = attrs.OfType<SerializedColumnAttribute>();
            var reference = attrs.OfType<ReferenceAttribute>();
            var aliasColumn = attrs.OfType<AliasAttribute>().FirstOrDefault();

            // Check if declaring poco has [ExplicitColumns] attribute
            var explicitColumns = mi.DeclaringType.GetTypeInfo().GetCustomAttributes(typeof(ExplicitColumnsAttribute), true).Any();

            // Ignore column if declarying poco has [ExplicitColumns] attribute
            // and property doesn't have an explicit [Column] attribute,
            // or property has an [Ignore] attribute
            if ((explicitColumns && !colAttrs.Any() && !reference.Any() && !complexMapping.Any()) || ignoreAttrs.Any())
            {
                ci.IgnoreColumn = true;
            }

            if (complexMapping.Any())
            {
                ci.ComplexMapping = true;
                ci.ComplexPrefix = complexMapping.First().CustomPrefix;
            }
            else if (serializedColumnAttributes.Any())
            {
                ci.SerializedColumn = true;
            }
            else if (reference.Any())
            {
                ci.ReferenceType = reference.First().ReferenceType;
                ci.ReferenceMemberName = reference.First().ReferenceMemberName ?? "Id";
                ci.ColumnName = reference.First().ColumnName ?? mi.Name + "Id";
                return ci;
            }
            else if (PocoDataBuilder.IsList(mi))
            {
                ci.ReferenceType = ReferenceType.Many;
                return ci;
            }
            else if (mi.GetMemberInfoType().IsAClass() && !colAttrs.Any())
            {
                ci.ComplexMapping = true;
            }

            // Read attribute
            if (colAttrs.Any())
            {
                var colattr = colAttrs.First();
                ci.ColumnName = colattr.Name ?? mi.Name;
                ci.ForceToUtc = colattr.ForceToUtc;
                ci.ResultColumn = colattr is ResultColumnAttribute;
                ci.VersionColumn = colattr is VersionColumnAttribute;
                ci.VersionColumnType = ci.VersionColumn ? ((VersionColumnAttribute) colattr).VersionColumnType : ci.VersionColumnType;
                ci.ComputedColumn = colattr is ComputedColumnAttribute;
                ci.ComputedColumnType = ci.ComputedColumn ? ((ComputedColumnAttribute)colattr).ComputedColumnType : ComputedColumnType.Always;
            }
            else
            {
                ci.ColumnName = mi.Name;
            }

            ci.ColumnAlias = aliasColumn != null ? aliasColumn.Alias : null;

            if (columnTypeAttrs.Any())
            {
                ci.ColumnType = columnTypeAttrs.First().Type;
            }

            return ci;
        }
开发者ID:schotime,项目名称:NPoco,代码行数:75,代码来源:ColumnInfo.cs

示例5: GetFromDbConverter

 public virtual Func<object, object> GetFromDbConverter(MemberInfo mi, Type SourceType)
 {
     var t = mi.GetMemberInfoType();
     return mi != null ? GetFromDbConverter(t, SourceType) : null;
 }
开发者ID:robertmilne,项目名称:NPoco,代码行数:5,代码来源:DefaultMapper.cs


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