コード例 #1
0
ファイル: EntityFactories.cs プロジェクト: priaonehaha/HnD
 /// <summary>Creates a new, empty Entity object of the type specified</summary>
 /// <param name="entityTypeToCreate">The entity type to create.</param>
 /// <returns>A new, empty Entity object.</returns>
 public static IEntity Create(SD.HnD.DAL.EntityType entityTypeToCreate)
 {
     IEntityFactory factoryToUse = null;
     switch(entityTypeToCreate)
     {
         case SD.HnD.DAL.EntityType.ActionRightEntity:
             factoryToUse = new ActionRightEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.AttachmentEntity:
             factoryToUse = new AttachmentEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.AuditActionEntity:
             factoryToUse = new AuditActionEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.AuditDataCoreEntity:
             factoryToUse = new AuditDataCoreEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.AuditDataMessageRelatedEntity:
             factoryToUse = new AuditDataMessageRelatedEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.AuditDataThreadRelatedEntity:
             factoryToUse = new AuditDataThreadRelatedEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.BookmarkEntity:
             factoryToUse = new BookmarkEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.ForumEntity:
             factoryToUse = new ForumEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.ForumRoleForumActionRightEntity:
             factoryToUse = new ForumRoleForumActionRightEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.IPBanEntity:
             factoryToUse = new IPBanEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.MessageEntity:
             factoryToUse = new MessageEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.RoleEntity:
             factoryToUse = new RoleEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.RoleAuditActionEntity:
             factoryToUse = new RoleAuditActionEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.RoleSystemActionRightEntity:
             factoryToUse = new RoleSystemActionRightEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.RoleUserEntity:
             factoryToUse = new RoleUserEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.SectionEntity:
             factoryToUse = new SectionEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.SupportQueueEntity:
             factoryToUse = new SupportQueueEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.SupportQueueThreadEntity:
             factoryToUse = new SupportQueueThreadEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.SystemDataEntity:
             factoryToUse = new SystemDataEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.ThreadEntity:
             factoryToUse = new ThreadEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.ThreadSubscriptionEntity:
             factoryToUse = new ThreadSubscriptionEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.UserEntity:
             factoryToUse = new UserEntityFactory();
             break;
         case SD.HnD.DAL.EntityType.UserTitleEntity:
             factoryToUse = new UserTitleEntityFactory();
             break;
     }
     IEntity toReturn = null;
     if(factoryToUse != null)
     {
         toReturn = factoryToUse.Create();
     }
     return toReturn;
 }
コード例 #2
0
ファイル: EntityFactories.cs プロジェクト: priaonehaha/HnD
        /// <summary>Creates a new, empty Entity object of the type specified</summary>
        /// <param name="entityTypeToCreate">The entity type to create.</param>
        /// <returns>A new, empty Entity object.</returns>
        public static IEntity Create(SD.HnD.DAL.EntityType entityTypeToCreate)
        {
            IEntityFactory factoryToUse = null;

            switch (entityTypeToCreate)
            {
            case SD.HnD.DAL.EntityType.ActionRightEntity:
                factoryToUse = new ActionRightEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.AttachmentEntity:
                factoryToUse = new AttachmentEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.AuditActionEntity:
                factoryToUse = new AuditActionEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.AuditDataCoreEntity:
                factoryToUse = new AuditDataCoreEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.AuditDataMessageRelatedEntity:
                factoryToUse = new AuditDataMessageRelatedEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.AuditDataThreadRelatedEntity:
                factoryToUse = new AuditDataThreadRelatedEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.BookmarkEntity:
                factoryToUse = new BookmarkEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.ForumEntity:
                factoryToUse = new ForumEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.ForumRoleForumActionRightEntity:
                factoryToUse = new ForumRoleForumActionRightEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.IPBanEntity:
                factoryToUse = new IPBanEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.MessageEntity:
                factoryToUse = new MessageEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.RoleEntity:
                factoryToUse = new RoleEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.RoleAuditActionEntity:
                factoryToUse = new RoleAuditActionEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.RoleSystemActionRightEntity:
                factoryToUse = new RoleSystemActionRightEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.RoleUserEntity:
                factoryToUse = new RoleUserEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.SectionEntity:
                factoryToUse = new SectionEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.SupportQueueEntity:
                factoryToUse = new SupportQueueEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.SupportQueueThreadEntity:
                factoryToUse = new SupportQueueThreadEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.SystemDataEntity:
                factoryToUse = new SystemDataEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.ThreadEntity:
                factoryToUse = new ThreadEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.ThreadSubscriptionEntity:
                factoryToUse = new ThreadSubscriptionEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.UserEntity:
                factoryToUse = new UserEntityFactory();
                break;

            case SD.HnD.DAL.EntityType.UserTitleEntity:
                factoryToUse = new UserTitleEntityFactory();
                break;
            }
            IEntity toReturn = null;

            if (factoryToUse != null)
            {
                toReturn = factoryToUse.Create();
            }
            return(toReturn);
        }