private DbContext GetDbContext(IDynamicEditForm form) { var type = form.GetDbContextType(); var context = Activator.CreateInstance(type) as DbContext; return(context); }
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)); }
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); }
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; }
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)); }