/// <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(ProductSearchEngine.EntityType entityTypeToCreate) { IEntityFactory factoryToUse = null; switch(entityTypeToCreate) { case ProductSearchEngine.EntityType.BrandEntity: factoryToUse = new BrandEntityFactory(); break; case ProductSearchEngine.EntityType.CategoryEntity: factoryToUse = new CategoryEntityFactory(); break; case ProductSearchEngine.EntityType.CityEntity: factoryToUse = new CityEntityFactory(); break; case ProductSearchEngine.EntityType.CommentEntity: factoryToUse = new CommentEntityFactory(); break; case ProductSearchEngine.EntityType.KeywordEntity: factoryToUse = new KeywordEntityFactory(); break; case ProductSearchEngine.EntityType.LastViewedProductEntity: factoryToUse = new LastViewedProductEntityFactory(); break; case ProductSearchEngine.EntityType.MembershipEntity: factoryToUse = new MembershipEntityFactory(); break; case ProductSearchEngine.EntityType.ProductEntity: factoryToUse = new ProductEntityFactory(); break; case ProductSearchEngine.EntityType.ProductKeywordEntity: factoryToUse = new ProductKeywordEntityFactory(); break; case ProductSearchEngine.EntityType.ProductPhotoEntity: factoryToUse = new ProductPhotoEntityFactory(); break; case ProductSearchEngine.EntityType.ProductSpecificationEntity: factoryToUse = new ProductSpecificationEntityFactory(); break; case ProductSearchEngine.EntityType.RateEntity: factoryToUse = new RateEntityFactory(); break; case ProductSearchEngine.EntityType.RoleEntity: factoryToUse = new RoleEntityFactory(); break; case ProductSearchEngine.EntityType.StoreEntity: factoryToUse = new StoreEntityFactory(); break; case ProductSearchEngine.EntityType.StoreInformationEntity: factoryToUse = new StoreInformationEntityFactory(); break; case ProductSearchEngine.EntityType.WebTrackerEntity: factoryToUse = new WebTrackerEntityFactory(); break; } IEntity toReturn = null; if(factoryToUse != null) { toReturn = factoryToUse.Create(); } return toReturn; }
/// <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(ProductSearchEngine.EntityType entityTypeToCreate) { IEntityFactory factoryToUse = null; switch (entityTypeToCreate) { case ProductSearchEngine.EntityType.BrandEntity: factoryToUse = new BrandEntityFactory(); break; case ProductSearchEngine.EntityType.CategoryEntity: factoryToUse = new CategoryEntityFactory(); break; case ProductSearchEngine.EntityType.CityEntity: factoryToUse = new CityEntityFactory(); break; case ProductSearchEngine.EntityType.CommentEntity: factoryToUse = new CommentEntityFactory(); break; case ProductSearchEngine.EntityType.KeywordEntity: factoryToUse = new KeywordEntityFactory(); break; case ProductSearchEngine.EntityType.LastViewedProductEntity: factoryToUse = new LastViewedProductEntityFactory(); break; case ProductSearchEngine.EntityType.MembershipEntity: factoryToUse = new MembershipEntityFactory(); break; case ProductSearchEngine.EntityType.ProductEntity: factoryToUse = new ProductEntityFactory(); break; case ProductSearchEngine.EntityType.ProductKeywordEntity: factoryToUse = new ProductKeywordEntityFactory(); break; case ProductSearchEngine.EntityType.ProductPhotoEntity: factoryToUse = new ProductPhotoEntityFactory(); break; case ProductSearchEngine.EntityType.ProductSpecificationEntity: factoryToUse = new ProductSpecificationEntityFactory(); break; case ProductSearchEngine.EntityType.RateEntity: factoryToUse = new RateEntityFactory(); break; case ProductSearchEngine.EntityType.RoleEntity: factoryToUse = new RoleEntityFactory(); break; case ProductSearchEngine.EntityType.StoreEntity: factoryToUse = new StoreEntityFactory(); break; case ProductSearchEngine.EntityType.StoreInformationEntity: factoryToUse = new StoreInformationEntityFactory(); break; case ProductSearchEngine.EntityType.WebTrackerEntity: factoryToUse = new WebTrackerEntityFactory(); break; } IEntity toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }