/// <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 IEntity2 Create(DAL.ManageDocument.EntityType entityTypeToCreate) { IEntityFactory2 factoryToUse = null; switch (entityTypeToCreate) { case DAL.ManageDocument.EntityType.CauHinhEntity: factoryToUse = new CauHinhEntityFactory(); break; case DAL.ManageDocument.EntityType.ChuyenVienEntity: factoryToUse = new ChuyenVienEntityFactory(); break; case DAL.ManageDocument.EntityType.CongTyDoVeEntity: factoryToUse = new CongTyDoVeEntityFactory(); break; case DAL.ManageDocument.EntityType.HuyenEntity: factoryToUse = new HuyenEntityFactory(); break; case DAL.ManageDocument.EntityType.LoaiBienDongEntity: factoryToUse = new LoaiBienDongEntityFactory(); break; case DAL.ManageDocument.EntityType.LoaiGiayToEntity: factoryToUse = new LoaiGiayToEntityFactory(); break; case DAL.ManageDocument.EntityType.NguoiDungEntity: factoryToUse = new NguoiDungEntityFactory(); break; case DAL.ManageDocument.EntityType.ThongTinHoSoEntity: factoryToUse = new ThongTinHoSoEntityFactory(); break; case DAL.ManageDocument.EntityType.TinhEntity: factoryToUse = new TinhEntityFactory(); break; case DAL.ManageDocument.EntityType.XaEntity: factoryToUse = new XaEntityFactory(); break; } IEntity2 toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
/// <summary>Gets the factory of the entity with the DAL.ManageDocument.EntityType specified</summary> /// <param name="typeOfEntity">The type of entity.</param> /// <returns>factory to use or null if not found</returns> public static IEntityFactory2 GetFactory(DAL.ManageDocument.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> /// <param name="isInHierarchy">If true, the entity of this factory is in an inheritance hierarchy, false otherwise</param> public EntityFactoryBase2(string entityName, DAL.ManageDocument.EntityType typeOfEntity, bool isInHierarchy) : base(entityName) { _typeOfEntity = typeOfEntity; _isInHierarchy = isInHierarchy; }