/// <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(ProductSearchEngine.EntityType typeToUse) { switch (typeToUse) { case ProductSearchEngine.EntityType.BrandEntity: return(new BrandCollection()); case ProductSearchEngine.EntityType.CategoryEntity: return(new CategoryCollection()); case ProductSearchEngine.EntityType.CityEntity: return(new CityCollection()); case ProductSearchEngine.EntityType.CommentEntity: return(new CommentCollection()); case ProductSearchEngine.EntityType.KeywordEntity: return(new KeywordCollection()); case ProductSearchEngine.EntityType.LastViewedProductEntity: return(new LastViewedProductCollection()); case ProductSearchEngine.EntityType.MembershipEntity: return(new MembershipCollection()); case ProductSearchEngine.EntityType.ProductEntity: return(new ProductCollection()); case ProductSearchEngine.EntityType.ProductKeywordEntity: return(new ProductKeywordCollection()); case ProductSearchEngine.EntityType.ProductPhotoEntity: return(new ProductPhotoCollection()); case ProductSearchEngine.EntityType.ProductSpecificationEntity: return(new ProductSpecificationCollection()); case ProductSearchEngine.EntityType.RateEntity: return(new RateCollection()); case ProductSearchEngine.EntityType.RoleEntity: return(new RoleCollection()); case ProductSearchEngine.EntityType.StoreEntity: return(new StoreCollection()); case ProductSearchEngine.EntityType.StoreInformationEntity: return(new StoreInformationCollection()); case ProductSearchEngine.EntityType.WebTrackerEntity: return(new WebTrackerCollection()); default: return(null); } }
/// <summary>CTor</summary> /// <param name="entityName">Name of the entity.</param> /// <param name="typeOfEntity">The type of entity.</param> public EntityFactoryBase(string entityName, ProductSearchEngine.EntityType typeOfEntity) : base(entityName) { _typeOfEntity = typeOfEntity; }
/// <summary>Gets the factory of the entity with the ProductSearchEngine.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(ProductSearchEngine.EntityType typeOfEntity) { return(GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType())); }
/// <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); }