Beispiel #1
0
        /// <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(EntityModel.EntityType entityTypeToCreate)
        {
            IEntityFactory2 factoryToUse = null;

            switch (entityTypeToCreate)
            {
            case EntityModel.EntityType.PersonEntity:
                factoryToUse = new PersonEntityFactory();
                break;

            case EntityModel.EntityType.ActorEntity:
                factoryToUse = new ActorEntityFactory();
                break;

            case EntityModel.EntityType.ActorIncidentEntity:
                factoryToUse = new ActorIncidentEntityFactory();
                break;

            case EntityModel.EntityType.CollectionEntity:
                factoryToUse = new CollectionEntityFactory();
                break;

            case EntityModel.EntityType.IncidentEntity:
                factoryToUse = new IncidentEntityFactory();
                break;

            case EntityModel.EntityType.ItemEntity:
                factoryToUse = new ItemEntityFactory();
                break;

            case EntityModel.EntityType.DomainItemEntity:
                factoryToUse = new DomainItemEntityFactory();
                break;

            case EntityModel.EntityType.SpecificItemEntity:
                factoryToUse = new SpecificItemEntityFactory();
                break;
            }
            IEntity2 toReturn = null;

            if (factoryToUse != null)
            {
                toReturn = factoryToUse.Create();
            }
            return(toReturn);
        }
Beispiel #2
0
 /// <summary>Gets the factory of the entity with the EntityModel.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(EntityModel.EntityType typeOfEntity)
 {
     return(GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType()));
 }
Beispiel #3
0
 /// <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, EntityModel.EntityType typeOfEntity, bool isInHierarchy) : base(entityName)
 {
     _typeOfEntity  = typeOfEntity;
     _isInHierarchy = isInHierarchy;
 }