/// <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(Project.DAL.EntityType entityTypeToCreate) { IEntityFactory2 factoryToUse = null; switch (entityTypeToCreate) { case Project.DAL.EntityType.VehicleMakeEntity: factoryToUse = new VehicleMakeEntityFactory(); break; case Project.DAL.EntityType.VehicleModelEntity: factoryToUse = new VehicleModelEntityFactory(); break; } IEntity2 toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
/// <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, Project.DAL.EntityType typeOfEntity, bool isInHierarchy) : base(entityName) { _typeOfEntity = typeOfEntity; _isInHierarchy = isInHierarchy; }
/// <summary>Gets the factory of the entity with the Project.DAL.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(Project.DAL.EntityType typeOfEntity) { return(GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType())); }