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


C# EntityInfo类代码示例

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


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

示例1: ParseMemberNames

 public static IList<EntityKeyMemberInfo> ParseMemberNames(EntityInfo entity, string names, bool ordered = false, Action<string> errorAction = null)
 {
     var specs = StringHelper.SplitNames(names);
       var mList = new List<EntityKeyMemberInfo>();
       foreach(var spec in specs) {
     bool desc = false;
     string[] parts;
     if(ordered) {
       parts = StringHelper.SplitNames(spec, ':');
       if(parts.Length > 2) {
     if(errorAction != null) errorAction(spec);
     continue;
       }
       string strDesc = parts.Length == 1 ? "asc" : parts[1];
       switch(strDesc.ToLowerInvariant()) {
     case "":  case "asc": desc = false; break;
     case "desc": desc = true; break;
     default:
       if(errorAction != null)
         errorAction(spec);
       continue;
       }//switch
     }//if ordered
     else
       parts = new string[] { spec, null };
     var member = entity.GetMember(parts[0]);
     if(member == null) {
       if(errorAction != null)
     errorAction(spec);
     }
     mList.Add(new EntityKeyMemberInfo(member, desc));
       }//foreach spec
       return mList;
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:34,代码来源:EntityAttributeHelper.cs

示例2: Delete

        public static int Delete( int id, IEntity obj, EntityInfo entityInfo )
        {
            List<IInterceptor> ilist = MappingClass.Instance.InterceptorList;
            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].BeforDelete( obj );
            }

            int rowAffected = 0;
            rowAffected += deleteSingle( id, entityInfo );
            if (entityInfo.ChildEntityList.Count > 0) {
                foreach (EntityInfo info in entityInfo.ChildEntityList) {
                    rowAffected += deleteSingle( id, MappingClass.Instance.ClassList[info.Type.FullName] as EntityInfo );
                }
            }
            if (entityInfo.Parent != null) {
                IEntity objP = Entity.New( entityInfo.Parent.Type.FullName );
                rowAffected += deleteSingle( id, Entity.GetInfo( objP ) );
            }

            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].AfterDelete( obj );
            }

            CacheUtil.CheckCountCache( "delete", obj, entityInfo );

            return rowAffected;
        }
开发者ID:nust03,项目名称:xcore,代码行数:27,代码来源:DeleteOperation.cs

示例3: DeleteBatch

        public static int DeleteBatch( String condition, EntityInfo entityInfo )
        {
            if (strUtil.IsNullOrEmpty( condition )) {
                return 0;
            }

            String deleteSql = new SqlBuilder( entityInfo ).GetDeleteSql( condition );
            logger.Info(LoggerUtil.SqlPrefix+ "delete sql : " + deleteSql );

            List<IInterceptor> ilist = MappingClass.Instance.InterceptorList;
            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].BeforDeleteBatch( entityInfo.Type, condition );
            }

            IDbCommand cmd = DataFactory.GetCommand( deleteSql, DbContext.getConnection( entityInfo ) );
            int rowAffected = cmd.ExecuteNonQuery();
            logger.Info( "delete : " + rowAffected + " records affected" );
            cmd.Connection.Close();

            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].AfterDeleteBatch( entityInfo.Type, condition );
            }

            // update cache  timestamp
            CacheTime.updateTable( entityInfo.Type );

            return rowAffected;
        }
开发者ID:nust03,项目名称:xcore,代码行数:28,代码来源:DeleteOperation.cs

示例4: AddDeleteStatements

        private void AddDeleteStatements(IEntity entity, EntityInfo entityInfo)
        {
            foreach (var valueInfo in entityInfo.Values)
            {
                foreach (var value in entity.GetValues(valueInfo))
                {
                    var builder = new ComplexCommandBuilder();
                    var idParameter = value.Id.ToParameter();
                    builder.AddParameter(idParameter);
                    var whereClause = string.Format("{0}.{1} = {2}", valueInfo.Name, valueInfo.Identifer.Name, idParameter.Name);
                    var statement = new DeleteStatement(valueInfo.Name, whereClause);
                    builder.AddStatement(statement);
                    Add(builder);
                }
            }

            foreach (var childInfo in entityInfo.Children)
            {
                foreach (var child in entity.GetChildren(childInfo))
                {
                    var builder = new ComplexCommandBuilder();
                    var idParameter = child.Id.ToParameter();
                    builder.AddParameter(idParameter);
                    var whereClause = string.Format("{0}.{1} = {2}", childInfo.Name, childInfo.Identifier.Name, idParameter.Name);
                    var statement = new DeleteStatement(childInfo.Name, whereClause);
                    builder.AddStatement(statement);

                    AddDeleteStatements(child, childInfo);
                    Add(builder);
                }
            }
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:32,代码来源:PersistEntitiesBatch.cs

示例5: Update

        private static Result Update( IEntity obj, EntityInfo entityInfo ) {
            Result result = Validator.Validate( obj, "update" );
            if (result.IsValid == false) return result;

            List<IInterceptor> ilist = MappingClass.Instance.InterceptorList;
            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].BeforUpdate( obj );
            }

            updateSingle( obj, entityInfo );
            if (entityInfo.Parent != null) {
                IEntity objParent = Entity.New( entityInfo.Parent.Type.FullName );
                setParentValueFromChild( objParent, obj );
                updateSingle( objParent, Entity.GetInfo( objParent ) );
            }
            CacheUtil.CheckCountCache( "insert", obj, entityInfo );


            for (int i = 0; i < ilist.Count; i++) {
                ilist[i].AfterUpdate( obj );
            }
            result.Info = obj;

            // update cache  timestamp
            CacheTime.updateTable( entityInfo.Type );

            return result;
        }
开发者ID:mfz888,项目名称:xcore,代码行数:28,代码来源:UpdateOperation.cs

示例6: LinqCommand

        public EntityInfo TargetEntity; //for delete, insert, update

        #endregion Fields

        #region Constructors

        public LinqCommand(EntityQuery query, LinqCommandType commandType, LinqCommandKind kind, EntityInfo targetEntity)
        {
            Kind = kind;
              CommandType = commandType;
              Query = query;
              TargetEntity = targetEntity;
        }
开发者ID:yuanfei05,项目名称:vita,代码行数:13,代码来源:LinqCommand.cs

示例7: toString

 public static string toString(EntityInfo entityInfo)
 {
     entity = entityInfo.getName + " = {\n";
     addGenericAttributes(entityInfo);
     addComponentsAttributes(entityInfo);
     return entity + "\n},";
 }
开发者ID:Raysangar,项目名称:BadPrincess-LevelEditor,代码行数:7,代码来源:EntityInfoTranslator.cs

示例8: Create

 public static EntityMemberMask Create(EntityInfo entity, string propertiesOrGroups)
 {
     var invalidNames = new StringList();
       var mask = new EntityMemberMask(propertiesOrGroups, entity);
       var props = propertiesOrGroups.SplitNames(',', ';');
       foreach (var name in props) {
     //first try member
     if (string.IsNullOrWhiteSpace(name))
       continue;
     var grp = entity.GetPropertyGroup(name);
     if (grp != null) {
       foreach (var m in grp.Members)
     mask.Set(m);
       continue;
     }
     var member = entity.GetMember(name);
     if (member != null) {
       mask.Set(member);
       continue;
     }
     //name is invalid
     invalidNames.Add(name);
       }
       if (invalidNames.Count > 0)
     Util.Throw("Properties/subgroups [{0}] not found in entity {1}.", string.Join(",", invalidNames), entity.EntityType);
       return mask;
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:27,代码来源:EntityMemberMask.cs

示例9: EntityRelationSide

 /// <summary>
 ///     Initializes a new instance of the <see cref="T:System.Object" /> class.
 /// </summary>
 public EntityRelationSide(EntityInfo entity, NavigationPropertyEntityInfo property, NavigationType navigationType, SimplePropertyEntityInfo[] keyColumns)
 {
     Property = property;
     NavigationType = navigationType;
     KeyColumns = keyColumns;
     Entity = entity;
 }
开发者ID:HedinRakot,项目名称:Zierer,代码行数:10,代码来源:EntityRelationSide.cs

示例10: AddRootCommandBuilder

 private void AddRootCommandBuilder(EntityInfo entityInfo)
 {
     var builder = new ComplexCommandBuilder();
     builder.AddStatement(new CreateTableStatement(entityInfo));
     
     Add(builder);
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:7,代码来源:InitializeTypeBatch.cs

示例11: BuildCrudSelectAllPagedCommand

 public EntityCommand BuildCrudSelectAllPagedCommand(EntityInfo entity)
 {
     var cmd = AddCommand(entity.Name + "_SelectAllPaged", "Selects all entities.", EntityCommandKind.SelectAllPaged, entity);
       cmd.Parameters.Add(new EntityCommandParameter("__skiprows", typeof(int), 0, 0));
       cmd.Parameters.Add(new EntityCommandParameter("__maxrows", typeof(int), 0, int.MaxValue));
       return cmd;
 }
开发者ID:yuanfei05,项目名称:vita,代码行数:7,代码来源:EntityCommandBuilder.cs

示例12: SelectStatement

        public SelectStatement(EntityInfo entityInfo, string rootName, string rootIdAlias, string orderByClause)
        {
            if (entityInfo.IsRoot)
            {
                builder.AppendFormat("select distinct {0}.* from {0}", entityInfo.Name);
                if (!string.IsNullOrEmpty(rootName) && !string.IsNullOrEmpty(rootIdAlias))
                    builder.AppendFormat(" inner join {0} on {0}.{1} = {2}.{3}", rootName, rootIdAlias, entityInfo.Name, entityInfo.Identifier.Name);
                if (!string.IsNullOrEmpty(orderByClause))
                    builder.AppendFormat(" order by {0}", orderByClause);
                builder.Append(";");
            }
            else
            {
                builder.AppendFormat("select distinct {0}.* from {0}", entityInfo.Name);

                var previousName = entityInfo.Name;
                var previousIdName = entityInfo.Identifier.Name;
                var parent = entityInfo.Parent;
                while (parent != null)
                {
                    builder.AppendFormat(" inner join {0} on {0}.Id = {1}.Parent", parent.Name, previousName);
                    previousName = parent.Name;
                    previousIdName = parent.Identifier.Name;
                    parent = parent.Parent;
                }

                if (!string.IsNullOrEmpty(rootName) && !string.IsNullOrEmpty(rootIdAlias))
                    builder.AppendFormat(" inner join {0} on {0}.{1} = {2}.{3}", rootName, rootIdAlias, previousName, previousIdName);

                if (entityInfo.Sequence != null)
                    builder.AppendFormat(" order by {0}.{1}", entityInfo.Name, entityInfo.Sequence.Name);
            }
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:33,代码来源:SelectStatement.cs

示例13: getInsertSql

        private static String getInsertSql( EntityInfo entityInfo )
        {
            String str = "insert into " + entityInfo.TableName + " (";
            String fStr = "";
            String vStr = ") values(";
            for (int i = 0; i < entityInfo.SavedPropertyList.Count; i++) {
                EntityPropertyInfo info = entityInfo.SavedPropertyList[i];

                if ((
                    ( /**/!DbConfig.Instance.IsAutoId || !(info.Name.ToLower() == "id") || (entityInfo.Parent != null))
                    && info.SaveToDB)
                    && (!info.IsList && !info.IsList)
                    )
                {
                    String col = info.ColumnName ?? "";
                    fStr = fStr + col + ", ";
                    vStr = vStr + entityInfo.Dialect.GetParameter( info.ColumnName ) + ", ";
                }
            }
            fStr = fStr.Trim().TrimEnd( ',' );
            vStr = vStr.Trim().TrimEnd( ',' );
            str = str + fStr + vStr + ")";
            logger.Info( LoggerUtil.SqlPrefix + entityInfo.Name + " InsertSql:" + str );
            return str;
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:25,代码来源:InsertOperation.cs

示例14: Apply

 public override void Apply(EntityInfo victim)
 {
     if (victim != null)
     {
         victim.ReduceHealth(value * Time.deltaTime, DamageType.Effect);
     }
 }
开发者ID:JerethChampagne,项目名称:ArenaLegends,代码行数:7,代码来源:IBuffable.cs

示例15: OnStateLogicInit

 protected override void OnStateLogicInit(EntityInfo npc, long deltaTime)
 {
     AiStateInfo info = npc.GetAiStateInfo();
     info.Time = 0;
     info.HomePos = npc.GetMovementStateInfo().GetPosition3D();
     info.Target = 0;
     NotifyAiInitDslLogic(npc);
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:AiLogic_Npc_User.cs


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