コード例 #1
0
 /// <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);
 }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
ファイル: Repository.cs プロジェクト: ray-woods/Accounts
 public Repository(AccountsEntities context)
 {
     _ctx = context;
     _set = _ctx.Set <T>();
 }