public static void PrintSchema(IEntity2 entity, IPrefetchPath2 prefetchPath) { if (prefetchPath != null) { PrintSchema(prefetchPath, entity.GetEntityFactory().ForEntityName); } else { PrintEntityFields(entity, 0); } }
private static void PrintEntityFields(IEntity2 entity, int indentLevel) { string indent = "".PadLeft(indentLevel); foreach (IEntityField2 field in entity.Fields) { if (!field.IsPrimaryKey && !field.IsForeignKey) { string entityName = field.ContainingObjectName; string fieldName = field.Name; System.Console.Out.WriteLine(indent + entityName + "." + fieldName); } } }
/// <summary> /// Sets Field.CurrentValue from entityWhichUpdates to entityToUpdate. /// Doesn't change primary key field. /// </summary> public static void UpdateDataFromOtherObject(this IEntity2 entityToUpdate, IEntity2 entityWhichUpdates, string[] includeFields, string[] excludeFields) { foreach (IEntityField2 field in entityToUpdate.Fields) { if ((null == includeFields || includeFields.Contains(field.Name)) && (null == includeFields || !excludeFields.Contains(field.Name))) { if (!field.IsPrimaryKey && !object.Equals(field.CurrentValue, entityWhichUpdates.Fields[field.Name].CurrentValue)) { field.CurrentValue = entityWhichUpdates.Fields[field.Name].CurrentValue; field.IsChanged = true; entityToUpdate.IsDirty = true; } } } }
public override void SetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "Category2": SetupSyncCategory2(relatedEntity); break; case "Post": SetupSyncPost(relatedEntity); break; default: break; } }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { switch(fieldName) { case "Post": DesetupSyncPost(false, true); break; case "Tag": DesetupSyncTag(false, true); break; default: break; } }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "UserRoleLink": this.UserRoleLink.Remove(relatedEntity); break; default: break; } }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { switch(fieldName) { default: break; } }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { switch(fieldName) { case "Category1": DesetupSyncCategory1(false, true); break; case "Category2Post": base.PerformRelatedEntityRemoval(this.Category2Post, relatedEntity, signalRelatedEntityManyToOne); break; default: break; } }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { switch(propertyName) { case "Category1": this.Category1 = (Category1Entity)entity; break; default: break; } }
public long GetOrderItemId(IEntity2 itemEntity) { VerifyEntity(itemEntity); return(((EventPackageOrderItemEntity)itemEntity).OrderItemId); }
protected override void OnBeforeEntitySave(IEntity2 entitySaved, bool insertAction) { //FIXME : A décommenté si besoin //EntityAuditFieldSetter.DefineAuditFields(entitySaved, insertAction, this.User); base.OnBeforeEntitySave(entitySaved, insertAction); }
/// <summary> /// Gets the source table name of an <see cref="IEntity2"/> belongs to in the persistent storage. /// </summary> /// <param name="entity">The <see cref="IEntity2"/> to get the table name for.</param> /// <returns>Returns the source table name an <see cref="IEntity2"/> belongs to in the persistent storage.</returns> public string GetPersistentTableName(IEntity2 entity) { var i = GetFieldPersistenceInfo(entity.PrimaryKeyFields.First()); return(i.SourceObjectName); }
public static void AppendEntityInformation(List <string> messages, IEntity2 entity) { messages.Add(String.Format("Entity Name: {0}", entity.LLBLGenProEntityName)); messages.Add(String.Format("Entity Id: {0}", entity.PrimaryKeyFields[0].CurrentValue)); AppendFieldsInformation(messages, entity.Fields); }
/// <summary> setups the sync logic for member _post</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncPost(IEntity2 relatedEntity) { if(_post!=relatedEntity) { DesetupSyncPost(true, true); _post = (PostEntity)relatedEntity; base.PerformSetupSyncRelatedEntity( _post, new PropertyChangedEventHandler( OnPostPropertyChanged ), "Post", Category2PostEntity.Relations.PostEntityUsingFkPostId, true, new string[] { } ); } }
/// <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(SD.LLBLGen.Pro.Examples.EntityType entityTypeToCreate) { IEntityFactory2 factoryToUse = null; switch (entityTypeToCreate) { case SD.LLBLGen.Pro.Examples.EntityType.CategoryEntity: factoryToUse = new CategoryEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.CustomerEntity: factoryToUse = new CustomerEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.CustomerCustomerDemoEntity: factoryToUse = new CustomerCustomerDemoEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.CustomerDemographyEntity: factoryToUse = new CustomerDemographyEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.EmployeeEntity: factoryToUse = new EmployeeEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.EmployeeTerritoryEntity: factoryToUse = new EmployeeTerritoryEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.OrderEntity: factoryToUse = new OrderEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.OrderDetailEntity: factoryToUse = new OrderDetailEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.ProductEntity: factoryToUse = new ProductEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.RegionEntity: factoryToUse = new RegionEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.ShipperEntity: factoryToUse = new ShipperEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.SupplierEntity: factoryToUse = new SupplierEntityFactory(); break; case SD.LLBLGen.Pro.Examples.EntityType.TerritoryEntity: factoryToUse = new TerritoryEntityFactory(); break; } IEntity2 toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "ProductSection": DesetupSyncProductSection(false); break; case "Product": this.Product.Remove(relatedEntity); break; case "ProductSection_": this.ProductSection_.Remove(relatedEntity); break; default: break; } }
public static bool UpdateEntity(IEntity2 entity) { DataAccessAdapter ds = new DataAccessAdapter(); return(ds.SaveEntity(entity)); }
public override void SetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "Category1": SetupSyncCategory1(relatedEntity); break; case "Category2Post": this.Category2Post.Add((Category2PostEntity)relatedEntity); break; default: break; } }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { throw new NotImplementedException(); }
public override void SetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { default: break; } }
public override void SetRelatedEntity(IEntity2 relatedEntity, string fieldName) { throw new NotImplementedException(); }
/// <summary> setups the sync logic for member _role</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncRole(IEntity2 relatedEntity) { DesetupSyncRole(true); if(relatedEntity!=null) { _role = (RoleEntity)relatedEntity; _role.ActiveContext = base.ActiveContext; _role.AfterSave+=new EventHandler(OnEntityAfterSave); base.SetEntitySyncInformation("Role", _role, UserRoleLinkEntity.Relations.RoleEntityUsingRoleName); } }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { throw new NotImplementedException(); }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { switch(fieldName) { case "TeamPost": base.PerformRelatedEntityRemoval(this.TeamPost, relatedEntity, signalRelatedEntityManyToOne); break; case "WeeklyProgrammeMatch_": base.PerformRelatedEntityRemoval(this.WeeklyProgrammeMatch_, relatedEntity, signalRelatedEntityManyToOne); break; case "WeeklyProgrammeMatch": base.PerformRelatedEntityRemoval(this.WeeklyProgrammeMatch, relatedEntity, signalRelatedEntityManyToOne); break; default: break; } }
/// <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); }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { switch(propertyName) { case "Post": this.Post = (PostEntity)entity; break; case "Tag": this.Tag = (TagEntity)entity; break; default: break; } }
public long GetOrderItemId(IEntity2 itemEntity) { VerifyEntity(itemEntity); return(((GiftCertificateOrderItemEntity)itemEntity).OrderItemId); }
/// <summary> setups the sync logic for member _tag</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncTag(IEntity2 relatedEntity) { if(_tag!=relatedEntity) { DesetupSyncTag(true, true); _tag = (TagEntity)relatedEntity; base.PerformSetupSyncRelatedEntity( _tag, new PropertyChangedEventHandler( OnTagPropertyChanged ), "Tag", PostTagEntity.Relations.TagEntityUsingFkTagId, true, new string[] { } ); } }
public void CreateItemEntityReturnsProductOrderItemEntity() { IEntity2 entity = _productOrderItemTraits.CreateItemEntity(0, 0); Assert.IsInstanceOf <ProductOrderItemEntity>(entity, "CreateItemEntity returned incorrect type of entity."); }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { switch(propertyName) { case "Category2": this.Category2 = (Category2Entity)entity; break; case "Post": this.Post = (PostEntity)entity; break; default: break; } }
protected override void OnDeleteEntityComplete(IActionQuery deleteQuery, IEntity2 entityToDelete) { AuditInfo(entityToDelete, AuditInfoActionTypeEnum.Delete); base.OnDeleteEntityComplete(deleteQuery, entityToDelete); }
public override void SetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "ProductSection": SetupSyncProductSection(relatedEntity); break; case "Product": this.Product.Add(relatedEntity); break; case "ProductSection_": this.ProductSection_.Add(relatedEntity); break; default: break; } }
private void ThrowOnIEntity2IdAccess(IEntity2 entity) { Assert.That(() => entity.Id, Throws.TypeOf <ObjectNotFoundException>(), "IEntityId.Id access should lead to proxy initialization"); }
/// <summary> setups the sync logic for member _productSection</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncProductSection(IEntity2 relatedEntity) { DesetupSyncProductSection(true); if(relatedEntity!=null) { _productSection = (ProductSectionEntity)relatedEntity; _productSection.ActiveContext = base.ActiveContext; _productSection.AfterSave+=new EventHandler(OnEntityAfterSave); base.SetEntitySyncInformation("ProductSection", _productSection, ProductSectionEntity.Relations.ProductSectionEntityUsingParentSectionId); } }
private void CanAccessIEntity2Id(IEntity2 entity) { Assert.That(() => entity.Id, Throws.Nothing, "Failed to access proxy IEntity2.Id interface"); Assert.That(entity.Id, Is.EqualTo(_id)); }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { switch(fieldName) { case "Category1": DesetupSyncCategory1(false, true); break; default: break; } }
/// <summary> /// Sets the containing entity for the entities enlisted in this control. When a particular containing entity is set (e.g. 'Customer' for orders), the /// set entity is used to obtain the filter for the entities to show, and FilterToUse is then overruled. The entity is also used to produce FK field values /// for AddNew, so for example when a list of orders is shown, which are related to customer, the AddNew button should make the order's AddNew form preselect /// the Customer. /// </summary> /// <param name="containingEntity">The containing entity instance</param> /// <param name="name">the field name mapped on the relation from the containing entity with this entity</param> public void SetContainingEntity(IEntity2 containingEntity, string name) { switch (containingEntity.LLBLGenProEntityName) { case "EmployeeEntity": switch (name) { case "Employees_": _EmployeeDS.FilterToUse = ((EmployeeEntity)containingEntity).GetRelationInfoEmployees_(); ViewState["additionalFilters"] = "&EmployeeId=" + ((EmployeeEntity)containingEntity).EmployeeId + "&20FkField=ReportsTo"; break; default: break; } break; case "EmployeeTerritoryEntity": switch (name) { default: break; } break; case "OrderEntity": switch (name) { default: break; } break; case "TerritoryEntity": switch (name) { case "EmployeesCollectionViaEmployeeTerritories": _EmployeeDS.FilterToUse = ((TerritoryEntity)containingEntity).GetRelationInfoEmployeesCollectionViaEmployeeTerritories(); break; default: break; } break; case "CustomerEntity": switch (name) { case "EmployeesCollectionViaOrders": _EmployeeDS.FilterToUse = ((CustomerEntity)containingEntity).GetRelationInfoEmployeesCollectionViaOrders(); break; default: break; } break; case "ShipperEntity": switch (name) { case "EmployeesCollectionViaOrders": _EmployeeDS.FilterToUse = ((ShipperEntity)containingEntity).GetRelationInfoEmployeesCollectionViaOrders(); break; default: break; } break; default: break; } }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { switch(propertyName) { case "Category1": this.Category1 = (Category1Entity)entity; break; case "Category2Post": this.Category2Post.Add((Category2PostEntity)entity); break; case "PostCollectionViaCategory2Post": this.PostCollectionViaCategory2Post.IsReadOnly = false; this.PostCollectionViaCategory2Post.Add((PostEntity)entity); this.PostCollectionViaCategory2Post.IsReadOnly = true; break; default: break; } }
/// <summary> setups the sync logic for member _product</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncProduct(IEntity2 relatedEntity) { DesetupSyncProduct(true); if(relatedEntity!=null) { _product = (ProductEntity)relatedEntity; _product.ActiveContext = base.ActiveContext; _product.AfterSave+=new EventHandler(OnEntityAfterSave); base.SetEntitySyncInformation("Product", _product, SpecialOfferEntity.Relations.ProductEntityUsingProductId); } }
/// <summary> setups the sync logic for member _category1</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncCategory1(IEntity2 relatedEntity) { if(_category1!=relatedEntity) { DesetupSyncCategory1(true, true); _category1 = (Category1Entity)relatedEntity; base.PerformSetupSyncRelatedEntity( _category1, new PropertyChangedEventHandler( OnCategory1PropertyChanged ), "Category1", Category2Entity.Relations.Category1EntityUsingFkCategory1Id, true, new string[] { } ); } }
/// <summary> setups the sync logic for member _team</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncTeam(IEntity2 relatedEntity) { if(_team!=relatedEntity) { DesetupSyncTeam(true, true); _team = (TeamEntity)relatedEntity; base.PerformSetupSyncRelatedEntity( _team, new PropertyChangedEventHandler( OnTeamPropertyChanged ), "Team", TeamPostEntity.Relations.TeamEntityUsingFkTeamId, true, new string[] { } ); } }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { switch(propertyName) { default: break; } }
public override void SetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "TeamPost": this.TeamPost.Add((TeamPostEntity)relatedEntity); break; case "WeeklyProgrammeMatch_": this.WeeklyProgrammeMatch_.Add((WeeklyProgrammeMatchEntity)relatedEntity); break; case "WeeklyProgrammeMatch": this.WeeklyProgrammeMatch.Add((WeeklyProgrammeMatchEntity)relatedEntity); break; default: break; } }
public override void UnsetRelatedEntity(IEntity2 relatedEntity, string fieldName) { switch(fieldName) { case "Role": DesetupSyncRole(false); break; case "User": DesetupSyncUser(false); break; default: break; } }
public override void SetRelatedEntityProperty(string propertyName, IEntity2 entity) { switch(propertyName) { case "TeamPost": this.TeamPost.Add((TeamPostEntity)entity); break; case "WeeklyProgrammeMatch_": this.WeeklyProgrammeMatch_.Add((WeeklyProgrammeMatchEntity)entity); break; case "WeeklyProgrammeMatch": this.WeeklyProgrammeMatch.Add((WeeklyProgrammeMatchEntity)entity); break; case "PostCollectionViaTeamPost": this.PostCollectionViaTeamPost.IsReadOnly = false; this.PostCollectionViaTeamPost.Add((PostEntity)entity); this.PostCollectionViaTeamPost.IsReadOnly = true; break; case "WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch_": this.WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch_.IsReadOnly = false; this.WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch_.Add((WeeklyProgrammeDayEntity)entity); this.WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch_.IsReadOnly = true; break; case "WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch": this.WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch.IsReadOnly = false; this.WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch.Add((WeeklyProgrammeDayEntity)entity); this.WeeklyProgrammeDayCollectionViaWeeklyProgrammeMatch.IsReadOnly = true; break; default: break; } }
/// <summary> setups the sync logic for member _user</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncUser(IEntity2 relatedEntity) { DesetupSyncUser(true); if(relatedEntity!=null) { _user = (UserEntity)relatedEntity; _user.ActiveContext = base.ActiveContext; _user.AfterSave+=new EventHandler(OnEntityAfterSave); base.SetEntitySyncInformation("User", _user, UserRoleLinkEntity.Relations.UserEntityUsingUserId); } }
/// <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(NinjaSoftware.EnioNg.CoolJ.EntityType entityTypeToCreate) { IEntityFactory2 factoryToUse = null; switch (entityTypeToCreate) { case NinjaSoftware.EnioNg.CoolJ.EntityType.ArtiklEntity: factoryToUse = new ArtiklEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.AuditInfoEntity: factoryToUse = new AuditInfoEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.AuditInfoActionTypeRoEntity: factoryToUse = new AuditInfoActionTypeRoEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.BrojacEntity: factoryToUse = new BrojacEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.ConfigEntity: factoryToUse = new ConfigEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.EntityRoEntity: factoryToUse = new EntityRoEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.ErrorEntity: factoryToUse = new ErrorEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.FirmaEntity: factoryToUse = new FirmaEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.PartnerEntity: factoryToUse = new PartnerEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.PdvEntity: factoryToUse = new PdvEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.RacunGlavaEntity: factoryToUse = new RacunGlavaEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.RacunStavkaEntity: factoryToUse = new RacunStavkaEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.RoleRoEntity: factoryToUse = new RoleRoEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.StatusRoEntity: factoryToUse = new StatusRoEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.TarifaEntity: factoryToUse = new TarifaEntityFactory(); break; case NinjaSoftware.EnioNg.CoolJ.EntityType.UserEntity: factoryToUse = new UserEntityFactory(); break; } IEntity2 toReturn = null; if (factoryToUse != null) { toReturn = factoryToUse.Create(); } return(toReturn); }