/// <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(KSI.EntityType entityTypeToCreate) { IEntityFactory factoryToUse = null; switch (entityTypeToCreate) { case KSI.EntityType.AttendanceEntity: factoryToUse = new AttendanceEntityFactory(); break; case KSI.EntityType.AttendanceCodeEntity: factoryToUse = new AttendanceCodeEntityFactory(); break; case KSI.EntityType.ClassRegistrationEntity: factoryToUse = new ClassRegistrationEntityFactory(); break; case KSI.EntityType.CourseEntity: factoryToUse = new CourseEntityFactory(); break; case KSI.EntityType.GradeBookEntity: factoryToUse = new GradeBookEntityFactory(); break; case KSI.EntityType.GradeItemEntity: factoryToUse = new GradeItemEntityFactory(); break; case KSI.EntityType.OfferingEntity: factoryToUse = new OfferingEntityFactory(); break; case KSI.EntityType.OfferingScheduleEntity: factoryToUse = new OfferingScheduleEntityFactory(); break; case KSI.EntityType.SemesterEntity: factoryToUse = new SemesterEntityFactory(); break; case KSI.EntityType.StudentEntity: factoryToUse = new StudentEntityFactory(); break; case KSI.EntityType.UserEntity: factoryToUse = new UserEntityFactory(); break; } IEntity toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
/// <summary>Creates a new entity collection</summary> /// <param name="typeToUse">The entity type to create the collection for.</param> /// <returns>A new entity collection object.</returns> public static IEntityCollection Create(KSI.EntityType typeToUse) { switch (typeToUse) { case KSI.EntityType.AttendanceEntity: return(new AttendanceCollection()); case KSI.EntityType.AttendanceCodeEntity: return(new AttendanceCodeCollection()); case KSI.EntityType.ClassRegistrationEntity: return(new ClassRegistrationCollection()); case KSI.EntityType.CourseEntity: return(new CourseCollection()); case KSI.EntityType.GradeBookEntity: return(new GradeBookCollection()); case KSI.EntityType.GradeItemEntity: return(new GradeItemCollection()); case KSI.EntityType.OfferingEntity: return(new OfferingCollection()); case KSI.EntityType.OfferingScheduleEntity: return(new OfferingScheduleCollection()); case KSI.EntityType.SemesterEntity: return(new SemesterCollection()); case KSI.EntityType.StudentEntity: return(new StudentCollection()); case KSI.EntityType.UserEntity: return(new UserCollection()); default: return(null); } }
/// <summary>Gets the factory of the entity with the KSI.EntityType specified</summary> /// <param name="typeOfEntity">The type of entity.</param> /// <returns>factory to use or null if not found</returns> public static IEntityFactory GetFactory(KSI.EntityType typeOfEntity) { return(GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType())); }
/// <summary>CTor</summary> /// <param name="entityName">Name of the entity.</param> /// <param name="typeOfEntity">The type of entity.</param> public EntityFactoryBase(string entityName, KSI.EntityType typeOfEntity) : base(entityName) { _typeOfEntity = typeOfEntity; }