/// <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(Northwind.Data.EntityType entityTypeToCreate) { IEntityFactory2 factoryToUse = null; switch (entityTypeToCreate) { case Northwind.Data.EntityType.CategoryEntity: factoryToUse = new CategoryEntityFactory(); break; case Northwind.Data.EntityType.CustomerEntity: factoryToUse = new CustomerEntityFactory(); break; case Northwind.Data.EntityType.CustomerCustomerDemoEntity: factoryToUse = new CustomerCustomerDemoEntityFactory(); break; case Northwind.Data.EntityType.CustomerDemographicEntity: factoryToUse = new CustomerDemographicEntityFactory(); break; case Northwind.Data.EntityType.EmployeeEntity: factoryToUse = new EmployeeEntityFactory(); break; case Northwind.Data.EntityType.EmployeeTerritoryEntity: factoryToUse = new EmployeeTerritoryEntityFactory(); break; case Northwind.Data.EntityType.OrderEntity: factoryToUse = new OrderEntityFactory(); break; case Northwind.Data.EntityType.OrderDetailEntity: factoryToUse = new OrderDetailEntityFactory(); break; case Northwind.Data.EntityType.ProductEntity: factoryToUse = new ProductEntityFactory(); break; case Northwind.Data.EntityType.RegionEntity: factoryToUse = new RegionEntityFactory(); break; case Northwind.Data.EntityType.ShipperEntity: factoryToUse = new ShipperEntityFactory(); break; case Northwind.Data.EntityType.SupplierEntity: factoryToUse = new SupplierEntityFactory(); break; case Northwind.Data.EntityType.TerritoryEntity: factoryToUse = new TerritoryEntityFactory(); break; } IEntity2 toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
/// <summary>Gets the factory of the entity with the Northwind.Data.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(Northwind.Data.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, Northwind.Data.EntityType typeOfEntity, bool isInHierarchy) : base(entityName) { _typeOfEntity = typeOfEntity; _isInHierarchy = isInHierarchy; }