private DbContext GetDbContext(IDynamicEditForm form)
        {
            var type    = form.GetDbContextType();
            var context = Activator.CreateInstance(type) as DbContext;

            return(context);
        }
예제 #2
0
        public object UpdateItem(IDynamicEditForm form, object item)
        {
            var type = form.GetDbContextType();

            if (type.IsSubclassOf(typeof(DbContext)))
            {
                return(_entityProvider.UpdateItem(form, item));
            }

            return(_storeProvider.UpdateItem(form, item));
        }
예제 #3
0
        public IEnumerable <DataField> GetFormFields(IDynamicEditForm form)
        {
            var type = form.GetDbContextType();

            if (type.IsSubclassOf(typeof(DbContext)))
            {
                return(_entityProvider.GetFormFields(form));
            }

            return(_storeProvider.GetFormFields(form));
        }
        private DataContextBase GetDbContext(IDynamicEditForm form)
        {
            if (_db != null)
            {
                return(_db);
            }

            var type = form.GetDbContextType();

            _db = Activator.CreateInstance(type) as DataContextBase;
            return(_db);
        }
예제 #5
0
        public void DeleteItem(IDynamicEditForm form, object item)
        {
            var type = form.GetDbContextType();

            if (type.IsSubclassOf(typeof(DbContext)))
            {
                _entityProvider.DeleteItem(form, item);
                return;
            }

            _storeProvider.DeleteItem(form, item);
            return;
        }
예제 #6
0
        public IList GetEntityData(IDynamicEditForm form, Type entity)
        {
            if (entity.IsEnum)
            {
                var result = Enum.GetValues(entity);
                return(result);
            }

            var type = form.GetDbContextType();

            if (type.IsSubclassOf(typeof(DbContext)))
            {
                return(_entityProvider.GetEntityData(form, entity));
            }

            return(_storeProvider.GetEntityData(form, entity));
        }