Esempio n. 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 IEntity Create(silverspun.RGBDiff.Dal.EntityType entityTypeToCreate)
        {
            IEntityFactory factoryToUse = null;

            switch (entityTypeToCreate)
            {
            case silverspun.RGBDiff.Dal.EntityType.ControlSetEntity:
                factoryToUse = new ControlSetEntityFactory();
                break;

            case silverspun.RGBDiff.Dal.EntityType.ControlSetColourEntity:
                factoryToUse = new ControlSetColourEntityFactory();
                break;

            case silverspun.RGBDiff.Dal.EntityType.ObserverDataSetEntity:
                factoryToUse = new ObserverDataSetEntityFactory();
                break;

            case silverspun.RGBDiff.Dal.EntityType.ObserverDataSetColourEntity:
                factoryToUse = new ObserverDataSetColourEntityFactory();
                break;
            }
            IEntity toReturn = null;

            if (factoryToUse != null)
            {
                toReturn = factoryToUse.Create();
            }
            return(toReturn);
        }
Esempio n. 2
0
        /// <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(silverspun.RGBDiff.Dal.EntityType typeToUse)
        {
            switch (typeToUse)
            {
            case silverspun.RGBDiff.Dal.EntityType.ControlSetEntity:
                return(new ControlSetCollection());

            case silverspun.RGBDiff.Dal.EntityType.ControlSetColourEntity:
                return(new ControlSetColourCollection());

            case silverspun.RGBDiff.Dal.EntityType.ObserverDataSetEntity:
                return(new ObserverDataSetCollection());

            case silverspun.RGBDiff.Dal.EntityType.ObserverDataSetColourEntity:
                return(new ObserverDataSetColourCollection());

            default:
                return(null);
            }
        }
Esempio n. 3
0
 /// <summary>Gets the factory of the entity with the silverspun.RGBDiff.Dal.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(silverspun.RGBDiff.Dal.EntityType typeOfEntity)
 {
     return(GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType()));
 }
Esempio n. 4
0
 /// <summary>CTor</summary>
 /// <param name="entityName">Name of the entity.</param>
 /// <param name="typeOfEntity">The type of entity.</param>
 public EntityFactoryBase(string entityName, silverspun.RGBDiff.Dal.EntityType typeOfEntity)
 {
     _entityName   = entityName;
     _typeOfEntity = typeOfEntity;
 }