Пример #1
0
        /// <summary>
        /// Creating an instance of the Service object from the entity type and Context
        /// </summary>
        /// <param name="TypeEntity">the entity type</param>
        /// <param name="context">the context</param>
        /// <returns></returns>
        public virtual IBaseBLO CreateEntityInstanceByTypeAndContext(Type TypeEntity, DbContext context)
        {
            Type     TypeEntityService = typeof(BaseBLO <>).MakeGenericType(TypeEntity);
            IBaseBLO EntityService     = (IBaseBLO)Activator.CreateInstance(TypeEntityService, context);

            return(EntityService);
        }
Пример #2
0
        /// <summary>
        /// Creating an instance of the Service object from the entity type
        /// </summary>
        /// <param name="TypeEntity">the entity type</param>
        /// <returns></returns>
        public override IBaseBLO CreateServiceBLOInstanceByTypeEntity(Type TypeEntity)
        {
            Type     TypeEntityService = typeof(BaseBLO <>).MakeGenericType(TypeEntity);
            IBaseBLO EntityService     = (IBaseBLO)Activator.CreateInstance(TypeEntityService, this.Context);

            return(EntityService);
        }