/// <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.DAL.EntityType entityTypeToCreate) { var factoryToUse = EntityFactoryFactory.GetFactory(entityTypeToCreate); IEntity2 toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
/// <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(Northwind.DAL.EntityType typeToUse) { switch (typeToUse) { case Northwind.DAL.EntityType.CategoryEntity: return(new CategoryCollection()); case Northwind.DAL.EntityType.CustomerEntity: return(new CustomerCollection()); case Northwind.DAL.EntityType.CustomerCustomerDemoEntity: return(new CustomerCustomerDemoCollection()); case Northwind.DAL.EntityType.CustomerDemographicEntity: return(new CustomerDemographicCollection()); case Northwind.DAL.EntityType.EmployeeEntity: return(new EmployeeCollection()); case Northwind.DAL.EntityType.EmployeeTerritoryEntity: return(new EmployeeTerritoryCollection()); case Northwind.DAL.EntityType.GroupEntity: return(new GroupCollection()); case Northwind.DAL.EntityType.OrderEntity: return(new OrderCollection()); case Northwind.DAL.EntityType.OrderDetailEntity: return(new OrderDetailCollection()); case Northwind.DAL.EntityType.ProductEntity: return(new ProductCollection()); case Northwind.DAL.EntityType.RegionEntity: return(new RegionCollection()); case Northwind.DAL.EntityType.ShipperEntity: return(new ShipperCollection()); case Northwind.DAL.EntityType.SupplierEntity: return(new SupplierCollection()); case Northwind.DAL.EntityType.TerritoryEntity: return(new TerritoryCollection()); default: return(null); } }
/// <summary>Gets the factory of the entity with the Northwind.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(Northwind.DAL.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 IEntity2 Create(Northwind.DAL.EntityType entityTypeToCreate) { IEntityFactory2 factoryToUse = null; switch (entityTypeToCreate) { case Northwind.DAL.EntityType.AuditActionTypeEntity: factoryToUse = new AuditActionTypeEntityFactory(); break; case Northwind.DAL.EntityType.AuditInfoEntity: factoryToUse = new AuditInfoEntityFactory(); break; case Northwind.DAL.EntityType.CategoryEntity: factoryToUse = new CategoryEntityFactory(); break; case Northwind.DAL.EntityType.CustomerEntity: factoryToUse = new CustomerEntityFactory(); break; case Northwind.DAL.EntityType.CustomerCustomerDemoEntity: factoryToUse = new CustomerCustomerDemoEntityFactory(); break; case Northwind.DAL.EntityType.CustomerDemographicEntity: factoryToUse = new CustomerDemographicEntityFactory(); break; case Northwind.DAL.EntityType.EmployeeEntity: factoryToUse = new EmployeeEntityFactory(); break; case Northwind.DAL.EntityType.EmployeeTerritoryEntity: factoryToUse = new EmployeeTerritoryEntityFactory(); break; case Northwind.DAL.EntityType.GroupEntity: factoryToUse = new GroupEntityFactory(); break; case Northwind.DAL.EntityType.OrderEntity: factoryToUse = new OrderEntityFactory(); break; case Northwind.DAL.EntityType.OrderAuditInfoEntity: factoryToUse = new OrderAuditInfoEntityFactory(); break; case Northwind.DAL.EntityType.OrderDetailEntity: factoryToUse = new OrderDetailEntityFactory(); break; case Northwind.DAL.EntityType.ProductEntity: factoryToUse = new ProductEntityFactory(); break; case Northwind.DAL.EntityType.RegionEntity: factoryToUse = new RegionEntityFactory(); break; case Northwind.DAL.EntityType.ShipperEntity: factoryToUse = new ShipperEntityFactory(); break; case Northwind.DAL.EntityType.SupplierEntity: factoryToUse = new SupplierEntityFactory(); break; case Northwind.DAL.EntityType.TerritoryEntity: factoryToUse = new TerritoryEntityFactory(); break; case Northwind.DAL.EntityType.UserEntity: factoryToUse = new UserEntityFactory(); break; case Northwind.DAL.EntityType.UserGroupEntity: factoryToUse = new UserGroupEntityFactory(); 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, Northwind.DAL.EntityType typeOfEntity, bool isInHierarchy) : base(entityName) { _typeOfEntity = typeOfEntity; _isInHierarchy = isInHierarchy; }
/// <summary>CTor</summary> /// <param name="entityName">Name of the entity.</param> /// <param name="typeOfEntity">The type of entity.</param> public EntityFactoryBase(string entityName, Northwind.DAL.EntityType typeOfEntity) : base(entityName) { _typeOfEntity = typeOfEntity; }
/// <summary>Gets the factory of the entity with the Northwind.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(Northwind.DAL.EntityType typeOfEntity) { switch (typeOfEntity) { case Northwind.DAL.EntityType.AuditActionTypeEntity: return(new AuditActionTypeEntityFactory()); case Northwind.DAL.EntityType.AuditInfoEntity: return(new AuditInfoEntityFactory()); case Northwind.DAL.EntityType.CategoryEntity: return(new CategoryEntityFactory()); case Northwind.DAL.EntityType.CustomerEntity: return(new CustomerEntityFactory()); case Northwind.DAL.EntityType.CustomerCustomerDemoEntity: return(new CustomerCustomerDemoEntityFactory()); case Northwind.DAL.EntityType.CustomerDemographicEntity: return(new CustomerDemographicEntityFactory()); case Northwind.DAL.EntityType.EmployeeEntity: return(new EmployeeEntityFactory()); case Northwind.DAL.EntityType.EmployeeTerritoryEntity: return(new EmployeeTerritoryEntityFactory()); case Northwind.DAL.EntityType.GroupEntity: return(new GroupEntityFactory()); case Northwind.DAL.EntityType.OrderEntity: return(new OrderEntityFactory()); case Northwind.DAL.EntityType.OrderAuditInfoEntity: return(new OrderAuditInfoEntityFactory()); case Northwind.DAL.EntityType.OrderDetailEntity: return(new OrderDetailEntityFactory()); case Northwind.DAL.EntityType.ProductEntity: return(new ProductEntityFactory()); case Northwind.DAL.EntityType.RegionEntity: return(new RegionEntityFactory()); case Northwind.DAL.EntityType.ShipperEntity: return(new ShipperEntityFactory()); case Northwind.DAL.EntityType.SupplierEntity: return(new SupplierEntityFactory()); case Northwind.DAL.EntityType.TerritoryEntity: return(new TerritoryEntityFactory()); case Northwind.DAL.EntityType.UserEntity: return(new UserEntityFactory()); case Northwind.DAL.EntityType.UserGroupEntity: return(new UserGroupEntityFactory()); default: return(null); } }
/// <summary>Initializes a new instance of the <see cref="DynamicRelation"/> class.</summary> /// <param name="leftOperand">The left operand which is a field.</param> /// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param> /// <param name="rightOperand">The right operand which is an entity.</param> /// <param name="aliasLeftOperand">The alias of the left operand. If you don't want to / need to alias the left operand (only alias if you have to), specify string.Empty.</param> /// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param> /// <param name="onClause">The on clause for the join.</param> public DynamicRelation(IEntityFieldCore leftOperand, JoinHint joinType, Northwind.DAL.EntityType rightOperand, string aliasLeftOperand, string aliasRightOperand, IPredicate onClause) { this.InitClass(joinType, aliasLeftOperand, aliasRightOperand, onClause, leftOperand, GeneralEntityFactory.Create(rightOperand)); }
/// <summary>Initializes a new instance of the <see cref="DynamicRelation"/> class.</summary> /// <param name="leftOperand">The left operand.</param> /// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param> /// <param name="rightOperand">The right operand which is an entity type.</param> /// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param> /// <param name="onClause">The on clause for the join.</param> public DynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, Northwind.DAL.EntityType rightOperand, string aliasRightOperand, IPredicate onClause) { this.InitClass(joinType, string.Empty, aliasRightOperand, onClause, leftOperand, GeneralEntityFactory.Create(rightOperand)); }