/// <summary> /// Gets all entities of a given type asynchronously /// </summary> public static void List <TModel>(Action <IList <TModel> > callback, Action <bool> isBusy, Action <Exception> exceptionCallback = null) where TModel : class { ExecuteAsync(() => { using (var context = new AccountsEntities()) { return(context.Set <TModel>().ToList()); } }, callback, isBusy, exceptionCallback); }
/// <summary> /// Get a list of filtered entities asynchronously /// </summary> public static void Where <TModel, TProperty>(Func <TModel, bool> predicate, Expression <Func <TModel, TProperty> > includePath, Action <IEnumerable <TModel> > callback, Action <bool> isBusy, Action <Exception> exceptionCallback = null) where TModel : class { ExecuteAsync(() => { using (var context = new AccountsEntities()) { return(context.Set <TModel>().Include(includePath).Where <TModel>(predicate)); } }, callback, isBusy, exceptionCallback); }
/// <summary> /// Find an entity by type and id asynchronously /// </summary> public static void Find <TModel>(object[] keyValues, Action <TModel> callback, Action <bool> isBusy, Action <Exception> exceptionCallback = null) where TModel : class { ExecuteAsync(() => { using (var context = new AccountsEntities()) { return(context.Set <TModel>().Find(keyValues)); } }, callback, isBusy, exceptionCallback); }
public Repository(AccountsEntities context) { _ctx = context; _set = _ctx.Set <T>(); }