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


C# MemberInfo.GetAttributeValue方法代码示例

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


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

示例1: IsForeignKey

 /// <summary>
 /// 是否是外键
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="member"></param>
 /// <returns></returns>
 public virtual bool IsForeignKey(MappingEntity entity, MemberInfo member)
 {
     return member.GetAttributeValue<NkjSoft.ORM.Data.Mapping.AssociationAttribute, bool>(p => p.IsForeignKey);
 }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:10,代码来源:BasicMapping.cs

示例2: IsUpdatable

        /// <summary>
        /// Determines if a property can be part of an update operation
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="member"></param>
        /// <returns></returns>
        public virtual bool IsUpdatable(MappingEntity entity, MemberInfo member)
        {
            //return !this.IsPrimaryKey(entity, member);
            //TODO: 2010-7-17 返回指定字段成员是否参与 Insert  或 Update  操作

            return member.GetAttributeValue<ColumnAttribute, bool>(p => p.InsertOrUpdatable);
        }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:13,代码来源:BasicMapping.cs

示例3: IsIdentity

 /// <summary>
 /// Determines if a property is generated on the server during insert
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="member">The member.</param>
 /// <returns>
 /// 	<c>true</c> if the specified entity is generated; otherwise, <c>false</c>.
 /// </returns>
 public virtual bool IsIdentity(MappingEntity entity, MemberInfo member)
 {
     bool isOk = member.GetAttributeValue<ColumnAttribute, bool>(p => p.IsIdentity);
     return isOk;
     //return entity.GetAttribute<bool>(member, m => m.IsGenerated);
 }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:14,代码来源:BasicMapping.cs

示例4: IsComputed

 /// <summary>
 /// Determines if a property is computed after insert or update
 /// </summary>
 /// <param name="entity">The entity.</param>
 /// <param name="member">The member.</param>
 /// <returns>
 /// 	<c>true</c> if the specified entity is computed; otherwise, <c>false</c>.
 /// </returns>
 public virtual bool IsComputed(MappingEntity entity, MemberInfo member)
 {
     return member.GetAttributeValue<ColumnAttribute, bool>(p => p.IsComputed);
     //return entity.GetAttribute<bool>(member, m => m.IsComputed);
 }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:13,代码来源:BasicMapping.cs

示例5: IsPrimaryKey

        /// <summary>
        /// Determines if a property represents or is part of the entities unique identity (often primary key)
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="member"></param>
        /// <returns></returns>
        public override bool IsPrimaryKey(MappingEntity entity, MemberInfo member)
        {
            return member.GetAttributeValue<ColumnAttribute, bool>(p => p.IsPrimaryKey);
            //return entity.GetAttribute<bool>(member, m => m.IsPrimaryKey);

            //Type entityType = entity.EntityType;
            ////TODO:最终,在这个位置去掉Insert 语句中,对象成员标记了 自动增长的特性的属性..将不参与 Insert 操作 s 
            //object[] cas = member.GetCustomAttributes(typeof(Mapping.ColumnAttribute), false);
            //if (cas.Length == 1)
            //{
            //    ColumnAttribute ca = cas[0] as ColumnAttribute;
            //    return ca.IsPrimaryKey;
            //}
            //return false;
        }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:21,代码来源:BasicMapping.cs

示例6: GetColumnDbType

 /// <summary>
 /// The type declaration for the column in the provider's syntax
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="member"></param>
 /// <returns>a string representing the type declaration or null</returns>
 public virtual string GetColumnDbType(MappingEntity entity, MemberInfo member)
 {
     return member.GetAttributeValue<ColumnAttribute, string>(p => p.DbType);
     //return entity.GetAttribute<string>(member, m => m.DbType);
     //return null;
 }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:12,代码来源:BasicMapping.cs


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