• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ORM.EntityPropertyInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中wojilu.ORM.EntityPropertyInfo的典型用法代码示例。如果您正苦于以下问题:C# EntityPropertyInfo类的具体用法?C# EntityPropertyInfo怎么用?C# EntityPropertyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntityPropertyInfo类属于wojilu.ORM命名空间,在下文中一共展示了EntityPropertyInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Validate

        public override void Validate( String action, IEntity target, EntityPropertyInfo info, Result result )
        {
            Object obj = target.get( info.Name );

            Boolean isNull = false;
            if (info.Type == typeof( String )) {
                if (obj == null) {
                    isNull = true;
                }
                else if (strUtil.IsNullOrEmpty( obj.ToString() )) {
                    isNull = true;
                }
            }
            else if (obj == null) {
                isNull = true;
            }

            if (isNull) {
                if (strUtil.HasText( this.Message )) {
                    result.Add( this.Message );
                }
                else {
                    EntityInfo ei = Entity.GetInfo( target );
                    String str = "[" + ei.FullName + "] : property \"" + info.Name + "\" ";
                    result.Add( str + "can not be null" );
                }
            }
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:28,代码来源:NotNullAttribute.cs


示例2: checkLength

 private static Boolean checkLength( EntityPropertyInfo info )
 {
     if (info.SaveAttribute == null) return false;
     if (info.SaveAttribute.LengthSetted() == false) return false;
     if (info.Type != typeof( String )) return false;
     return true;
 }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:7,代码来源:Validator.cs


示例3: addColumnSingle

 private void addColumnSingle( EntityInfo entity, StringBuilder sb, EntityPropertyInfo ep, String columnName ) {
     if (ep.Type == typeof( int )) {
         addColumn_Int( sb, ep, columnName );
     }
     else if (ep.Type == typeof( long )) {
         addColumn_Long( sb, columnName );
     }
     else if (ep.Type == typeof( DateTime )) {
         addColumn_Time( sb, columnName );
     }
     else if (ep.Type == typeof( decimal )) {
         addColumn_Decimal( entity, sb, ep, columnName );
     }
     else if (ep.Type == typeof( double )) {
         addColumn_Double( entity, sb, columnName );
     }
     else if (ep.Type == typeof( float )) {
         addColumn_Single( entity, sb, columnName );
     }
     else if (ep.Type == typeof( String )) {
         addColumn_String( entity, sb, ep, columnName );
     }
     else if (ep.IsEntity) {
         addColumn_entity( sb, columnName );
     }
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:26,代码来源:TableBuilderBase.cs


示例4: addColumn_Int

 protected override void addColumn_Int( StringBuilder sb, EntityPropertyInfo ep, String columnName ) {
     sb.Append( columnName );
     if (ep.Property.IsDefined( typeof( TinyIntAttribute ), false )) {
         sb.Append( " tinyint default 0, " );
     }
     else {
         sb.Append( " int default 0, " );
     }
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:9,代码来源:MySqlTableBuilder.cs


示例5: addColumn_ByColumnAttribute

 protected virtual void addColumn_ByColumnAttribute( EntityInfo entity, StringBuilder sb, EntityPropertyInfo ep, String columnName )
 {
     if (ep.SaveAttribute.Length < 255) {
         addColumn_ShortText( sb, columnName, ep.SaveAttribute.Length );
     }
     else if ((ep.SaveAttribute.Length > 255) && (ep.SaveAttribute.Length < 4000)) {
         addColumn_MiddleText( entity, sb, ep, columnName );
     }
     else {
         addColumn_LongText( entity, sb, columnName );
     }
 }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:12,代码来源:TableBuilderBase.cs


示例6: addColumn_Decimal

        protected override void addColumn_Decimal( EntityInfo entity, StringBuilder sb, EntityPropertyInfo ep, String columnName ) {
            if (ep.MoneyAttribute != null) {
                sb.Append( columnName );
                sb.Append( " currency default 0, " );
            }
            else {

                DecimalAttribute da = ep.DecimalAttribute;
                if (da == null) throw new Exception( "DecimalAttribute not found=" + entity.FullName + "_" + ep.Name );

                sb.Append( columnName );
                sb.Append( " decimal(" + da.Precision + "," + da.Scale + ") default 0, " );
            }
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:14,代码来源:AccessTableBuilder.cs


示例7: setEntityPropertyValueById

 private static void setEntityPropertyValueById( IEntity obj, ObjectInfo state, EntityPropertyInfo property, int pid )
 {
     if (!property.IsAbstractEntity) {
         IEntity objValue = Entity.New( property.Type.FullName );
         objValue.Id = pid;
         // state
         //objValue.state = new ObjectInfo( property.Type ).Copy( state );
         IEntity objCache = ObjectPool.FindOne( property.Type, objValue.Id );
         if (objCache != null) {
             objValue = objCache;
         }
         obj.set( property.Name, objValue );
     }
 }
开发者ID:robin88,项目名称:wojilu,代码行数:14,代码来源:FillUtil.cs


示例8: isContinue

        private static Boolean isContinue( String action, EntityPropertyInfo info, EntityInfo entityInfo )
        {
            if (info.SaveToDB == false) return true;
            if (info.IsList) return true;

            if (info.Name.Equals( "Id" )) {

                if (action.Equals( "update" )) return true;
                if (action.Equals( "insert" ) && entityInfo.Parent == null) return true;

            }

            return false;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:14,代码来源:OrmUtil.cs


示例9: Validate

        public override void Validate( String action, IEntity target, EntityPropertyInfo info, Result result )
        {
            if (!Regex.IsMatch( cvt.ToNotNull( target.get( info.Name ) ), this.Regexp, RegexOptions.Singleline )) {
                if (strUtil.HasText( this.Message )) {
                    result.Add( this.Message );
                }

                else {
                    EntityInfo ei = Entity.GetInfo( target );
                    String str = "[" + ei.FullName + "] : property \"" + info.Name + "\" ";
                    result.Add( str + " is not match the format pattern : " + this.Regexp );
                }

            }
        }
开发者ID:991899783,项目名称:BookShop,代码行数:15,代码来源:PatternAttribute.cs


示例10: Validate

        public override void Validate( String action, IEntity target, EntityPropertyInfo info, Result result )
        {
            Object obj = target.get( info.Name );

            EntityInfo ei = Entity.GetInfo( target );
            int count = getCount( action, target, ei, info, obj );

            if (count > 0) {
                if (strUtil.HasText( this.Message )) {
                    result.Add( this.Message );
                }

                else {
                    String str = "[" + ei.FullName + "] : property \"" + info.Name + "\" ";
                    result.Add( str + " should be unique, but it has been in database" );
                }
            }
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:18,代码来源:UniqueAttribute.cs


示例11: getCount

        private static int getCount( String action, IEntity target, EntityInfo entityInfo, EntityPropertyInfo info, Object obj )
        {
            if (obj == null) return 1;

            String usql;
            IDatabaseDialect dialect = entityInfo.Dialect;
            if (action.Equals( "update" )) {
                usql = String.Format( "select count(Id) from {0} where Id<>{3} and {1}={2}", entityInfo.TableName, info.ColumnName, dialect.GetParameter( info.Name ), target.Id );
            }
            else {
                usql = String.Format( "select count(Id) from {0} where {1}={2}", entityInfo.TableName, info.ColumnName, dialect.GetParameter( info.Name ) );
            }

            logger.Info( LoggerUtil.SqlPrefix + " validate unique sql : " + usql );
            IDbCommand cmd = DataFactory.GetCommand( usql, DbContext.getConnection( entityInfo ) );
            DataFactory.SetParameter( cmd, info.ColumnName, obj );
            return cvt.ToInt( cmd.ExecuteScalar() );
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:18,代码来源:UniqueAttribute.cs


示例12: isContinue

        private static Boolean isContinue( String action, EntityPropertyInfo info, EntityInfo entityInfo )
        {
            if (info.SaveToDB == false) return true;
            if (info.IsList) return true;

            if (info.Name.Equals( "Id" )) {

                if (action.Equals( "update" )) return true;

                // ����ʵ�������ʶ��
                if (/**/DbConfig.Instance.IsAutoId && action.Equals("insert")
                    && entityInfo.Parent == null
                    )
                    return true;
            }

            return false;
        }
开发者ID:991899783,项目名称:BookShop,代码行数:18,代码来源:OrmUtil.cs


示例13: AddPropertyToHashtable

 internal void AddPropertyToHashtable( EntityPropertyInfo p )
 {
     _propertyHashTable[p.Name] = p;
     if (strUtil.HasText( p.ColumnName )) {
         _propertyHashTableByColumn[p.ColumnName.ToLower()] = p;
     }
 }
开发者ID:hzc13,项目名称:wojilu,代码行数:7,代码来源:EntityInfo.cs


示例14: getEntityPropertyName

        private string getEntityPropertyName( EntityPropertyInfo ep, object propertyValue ) {

            IEntity pValue = propertyValue as IEntity;
            if (pValue == null) return "";

            string val = null;

            EntityInfo ei = Entity.GetInfo( pValue );

            if ((ei.GetProperty( "Name" ) != null) && (pValue.get( "Name" ) != null)) {
                val = pValue.get( "Name" ).ToString();
            }
            else if ((ei.GetProperty( "Title" ) != null) && (pValue.get( "Title" ) != null)) {
                val = pValue.get( "Title" ).ToString();
            }

            if (strUtil.HasText( val )) {
                String lnk = to( Model ) + "?typeName=" + ep.ParentEntityInfo.FullName + "&p=" + ep.Name + "&id=" + pValue.Id;
                return "<a title=\"" + ep.Type.FullName + ", Id=" + pValue.Id + "\" href=\"" + lnk + "\">" + val + "</a>";
            }
            else {
                return ep.Type.Name + "_" + pValue.Id;
            }
        }
开发者ID:jasonvip,项目名称:wojilu.CodeGenerator,代码行数:24,代码来源:CodeController.cs


示例15: getPropertyValue

 private string getPropertyValue( IEntity obj, EntityPropertyInfo ep ) {
     object val = obj.get( ep.Name );
     if (val == null) {
         return "";
     }
     return val.ToString();
 }
开发者ID:jasonvip,项目名称:wojilu.CodeGenerator,代码行数:7,代码来源:CodeController.cs


示例16: addColumn_String

 protected virtual void addColumn_String( EntityInfo entity, StringBuilder sb, EntityPropertyInfo ep, String columnName )
 {
     if (ep.LongTextAttribute != null) {
         addColumn_LongText( entity, sb, columnName );
     }
     else if (ep.SaveAttribute != null) {
         addColumn_ByColumnAttribute( entity, sb, ep, columnName );
     }
     else {
         addColumn_ShortText( sb, columnName, 250 );
     }
 }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:12,代码来源:TableBuilderBase.cs


示例17: addColumn_MiddleText

 protected virtual void addColumn_MiddleText( EntityInfo entity, StringBuilder sb, EntityPropertyInfo ep, String columnName )
 {
     addColumn_ShortText( sb, columnName, ep.SaveAttribute.Length );
 }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:4,代码来源:TableBuilderBase.cs


示例18: isAddColumn

        // 是否在sql中选择当前属性的column
        private Boolean isAddColumn(String selectedProperty, EntityPropertyInfo ep)
        {
            //选择字符串和属性完全同名
            if (selectedProperty.Equals(ep.Name)) return true;

            //属性Member,selectProperty为Member.Name,只要前缀相同,即可选取属性的columnName
            if (ep.IsEntity && selectedProperty.StartsWith(ep.Name + ".")) return true;

            return false;
        }
开发者ID:jmyd,项目名称:oms,代码行数:11,代码来源:SqlBuilder.cs


示例19: setEntityId

 private static void setEntityId( IDbCommand cmd, EntityPropertyInfo info, Object paramVal )
 {
     int id = ((IEntity)paramVal).Id;
     DataFactory.SetParameter( cmd, info.ColumnName, id );
 }
开发者ID:991899783,项目名称:BookShop,代码行数:5,代码来源:OrmUtil.cs


示例20: addColumn_MiddleText

 protected override void addColumn_MiddleText( EntityInfo entity, StringBuilder sb, EntityPropertyInfo temP, string columnName )
 {
     addColumn_LongText( entity, sb, columnName );
 }
开发者ID:991899783,项目名称:BookShop,代码行数:4,代码来源:AccessTableBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Expressions.Mul类代码示例发布时间:2022-05-26
下一篇:
C# ORM.EntityInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap