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


C# IEntity.set方法代码示例

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


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

示例1: setEntityByCheckNull

        /// <summary>
        /// 1.5新增,针对已删除用户应用 null object 模式
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="ep"></param>
        /// <param name="propertyValue"></param>
        public static void setEntityByCheckNull( IEntity obj, EntityPropertyInfo ep, Object propertyValue, int realUserId )
        {
            if (propertyValue == null && rft.IsInterface( ep.Type, typeof( IUser ) )) {

                IEntity user = getNullUser( realUserId );
                obj.set( ep.Name, user );
            }
            else {
                obj.set( ep.Name, propertyValue );
            }
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:17,代码来源:ValueSetter.cs

示例2: SetParameters

        internal static void SetParameters( IDbCommand cmd, String action, IEntity obj, EntityInfo entityInfo )
        {
            for (int i = 0; i < entityInfo.SavedPropertyList.Count; i++) {

                EntityPropertyInfo info = entityInfo.SavedPropertyList[i];

                if (isContinue( action, info, entityInfo )) continue;

                Object paramVal = obj.get( info.Name );
                if (paramVal == null && info.DefaultAttribute != null) {
                    paramVal = info.DefaultAttribute.Value;
                }

                if (paramVal == null) {
                    setDefaultValue( cmd, info, entityInfo );
                }
                else if (info.Type.IsSubclassOf( typeof( IEntity ) ) || MappingClass.Instance.ClassList.Contains( info.Type.FullName )) {
                    setEntityId( cmd, info, paramVal );
                }
                else {
                    paramVal = DataFactory.SetParameter( cmd, info.ColumnName, paramVal );
                    obj.set( info.Name, paramVal );
                }

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

示例3: Validate

        public static Result Validate(IEntity target, String action)
        {
            EntityInfo entityInfo = Entity.GetInfo(target);
            Result result = new Result();
            try
            {
                foreach (EntityPropertyInfo info in entityInfo.SavedPropertyList)
                {

                    if (!info.SaveToDB) continue;

                    if (checkLength(info))
                    {
                        Object val = target.get(info.Name);
                        if (val != null)
                            target.set(info.Name, strUtil.SubString(val.ToString(), info.SaveAttribute.Length));
                    }

                    foreach (ValidationAttribute vattr in info.ValidationAttributes)
                    {
                        vattr.Validate(action, target, info.Name, result);
                    }

                }
            }
            catch (Exception ex)
            {
                LogManager.GetLogger(typeof(Validator)).Error(ex.Message);
            }
            return result;
        }
开发者ID:nust03,项目名称:xcore,代码行数:31,代码来源:Validator.cs

示例4: setEntityPropertyValueById

        private static void setEntityPropertyValueById( IEntity obj, ObjectInfo state, EntityPropertyInfo property, long 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:2014AmethystCat,项目名称:wojilu,代码行数:14,代码来源:FillUtil.cs

示例5: setEntityByCheckNull

        /// <summary>
        /// 1.5新增,针对已删除用户应用 null object 模式
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="ep"></param>
        /// <param name="propertyValue"></param>
        public static void setEntityByCheckNull(IEntity obj, EntityPropertyInfo ep, Object propertyValue, int realUserId)
        {

            //Mobirds
            //if (propertyValue == null && rft.IsInterface(ep.Type, typeof(IUser)))
            //{
            //    IEntity user = getNullUser(realUserId);
            //    obj.set(ep.Name, user);
            //}
            //else
            //{
            //    obj.set(ep.Name, propertyValue);
            //}
            obj.set(ep.Name, propertyValue);

        }
开发者ID:mfz888,项目名称:xcore,代码行数:22,代码来源:ValueSetter.cs

示例6: Validate

        public static Result Validate( IEntity target, String action )
        {
            EntityInfo entityInfo = Entity.GetInfo( target );

            Result result = new Result();

            foreach (EntityPropertyInfo info in entityInfo.SavedPropertyList) {

                if (!info.SaveToDB) continue;

                if (checkLength(info)) {
                    Object val = target.get( info.Name );
                    if( val != null )
                        target.set( info.Name, strUtil.SubString( val.ToString(), info.SaveAttribute.Length ) );
                }

                foreach (ValidationAttribute vattr in info.ValidationAttributes) {
                    vattr.Validate( action, target, info.Name, result );
                }

            }

            return result;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:24,代码来源:Validator.cs

示例7: setParentValueFromChild

 private static void setParentValueFromChild( IEntity objParent, IEntity objChild )
 {
     List<EntityPropertyInfo> eplist = Entity.GetInfo( objParent ).SavedPropertyList;
     foreach (EntityPropertyInfo info in eplist) {
         objParent.set( info.Name, objChild.get( info.Name ) );
     }
 }
开发者ID:nust03,项目名称:xcore,代码行数:7,代码来源:UpdateOperation.cs

示例8: setPostValues

        //-----------------------------------------------------------------------------------------------------------

        private void setPostValues( EntityInfo ei, IEntity obj ) {

            foreach (EntityPropertyInfo pInfo in ei.SavedPropertyList) {

                if (pInfo.Name.Equals( "Id" )) continue;

                string postValue = ctx.Post( pInfo.Name );

                if (pInfo.IsLongText) {

                    if (rft.GetAttribute( pInfo.Property, typeof( HtmlTextAttribute ) ) != null) {
                        obj.set( pInfo.Name, ctx.PostHtmlAll( pInfo.Name ) );
                    }
                    else {
                        obj.set( pInfo.Name, postValue );
                    }
                }
                else if (pInfo.IsEntity) {
                    int postInt = cvt.ToInt( postValue );
                    IEntity pValue = Entity.New( pInfo.Type.FullName );
                    pValue.Id = postInt;
                    obj.set( pInfo.Name, pValue );
                }
                else {
                    object pValue2 = this.getPropertyValue( pInfo, postValue );
                    obj.set( pInfo.Name, pValue2 );
                }
            }
        }
开发者ID:jasonvip,项目名称:wojilu.CodeGenerator,代码行数:31,代码来源:CodeController.cs


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