Browse Source

changed DbSet to IQueryable

tags/v0.4.0
Robin Thoni 8 years ago
parent
commit
0d0b589378

+ 7
- 7
Luticate2.Utils/DataAccess/LuEfCrudDataAccess.cs View File

@@ -76,17 +76,17 @@ namespace Luticate2.Utils.DataAccess
76 76
             return id;
77 77
         }
78 78
 
79
-        protected virtual IQueryable<TModel> GetGetQueryable(TDbContext db, DbSet<TModel> table)
79
+        protected virtual IQueryable<TModel> GetGetQueryable(TDbContext db, IQueryable<TModel> table)
80 80
         {
81 81
             return table;
82 82
         }
83 83
 
84
-        protected virtual IQueryable<TModel> GetEditQueryable(TDbContext db, DbSet<TModel> table)
84
+        protected virtual IQueryable<TModel> GetEditQueryable(TDbContext db, IQueryable<TModel> table)
85 85
         {
86 86
             return table;
87 87
         }
88 88
 
89
-        protected virtual IQueryable<TModel> GetDeleteQueryable(TDbContext db, DbSet<TModel> table)
89
+        protected virtual IQueryable<TModel> GetDeleteQueryable(TDbContext db, IQueryable<TModel> table)
90 90
         {
91 91
             return table;
92 92
         }
@@ -107,14 +107,14 @@ namespace Luticate2.Utils.DataAccess
107 107
             return LuResult<T>.Error(LuStatus.NotFound, typeof(TModel).Name + ": Value not found", "");
108 108
         }
109 109
 
110
-        protected virtual IQueryable<TModel> GetFilterQuery(LuFilterDbo filter, TDbContext db, DbSet<TModel> table)
110
+        protected virtual IQueryable<TModel> GetFilterQuery(LuFilterDbo filter, TDbContext db, IQueryable<TModel> table)
111 111
         {
112 112
             return GetGetQueryable(db, table).Where(GetFilterExpression(filter));
113 113
         }
114 114
 
115 115
 
116 116
 
117
-        protected virtual LuResult<bool> _Add(TModel model, TDboCreate dbo, TDbContext db, DbSet<TModel> table)
117
+        protected virtual LuResult<bool> _Add(TModel model, TDboCreate dbo, TDbContext db, IQueryable<TModel> table)
118 118
         {
119 119
             return LuResult<bool>.Ok(true);
120 120
         }
@@ -268,7 +268,7 @@ namespace Luticate2.Utils.DataAccess
268 268
             return GetMultiple(orderBy, x => true, page, perPage, otherOrderBy);
269 269
         }
270 270
 
271
-        public virtual LuResult<LuPaginatedDbo<TDboRead>> GetMultiple(LuOrderByDbo orderBy, Func<TDbContext, DbSet<TModel>, IQueryable<TModel>> getQueryable,
271
+        public virtual LuResult<LuPaginatedDbo<TDboRead>> GetMultiple(LuOrderByDbo orderBy, Func<TDbContext, IQueryable<TModel>, IQueryable<TModel>> getQueryable,
272 272
             int page = 0, int perPage = int.MaxValue)
273 273
         {
274 274
             return Execute((db, table) =>
@@ -384,7 +384,7 @@ namespace Luticate2.Utils.DataAccess
384 384
             }
385 385
         }
386 386
 
387
-        protected virtual LuResult<bool> _EditSingleById(TModel model, TDboUpdate update, TDbContext db, DbSet<TModel> table)
387
+        protected virtual LuResult<bool> _EditSingleById(TModel model, TDboUpdate update, TDbContext db, IQueryable<TModel> table)
388 388
         {
389 389
             return LuResult<bool>.Ok(true);
390 390
         }

+ 1
- 1
TestUtils/DataAccess/LuUtilsFkPkGuidDataAccess.cs View File

@@ -19,7 +19,7 @@ namespace TestUtils.DataAccess
19 19
             return db.fk_pk_guids;
20 20
         }
21 21
 
22
-        protected override IQueryable<fk_pk_guids> GetGetQueryable(LuUtilsDbContext db, DbSet<fk_pk_guids> table)
22
+        protected override IQueryable<fk_pk_guids> GetGetQueryable(LuUtilsDbContext db, IQueryable<fk_pk_guids> table)
23 23
         {
24 24
             return table.Include(guids => guids.fk_pk_guid);
25 25
         }

+ 3
- 2
TestUtils/DataAccess/LuUtilsPkGuidDataAccess.cs View File

@@ -1,4 +1,5 @@
1 1
 using System;
2
+using System.Linq;
2 3
 using System.Linq.Expressions;
3 4
 using Luticate2.Utils.DataAccess;
4 5
 using Luticate2.Utils.Dbo.Filter;
@@ -70,7 +71,7 @@ namespace TestUtils.DataAccess
70 71
                             && (someInt == null || model.some_int == someInt);
71 72
         }
72 73
 
73
-        protected override LuResult<bool> _Add(pk_guid model, PkGuidAddDbo dbo, LuUtilsDbContext db, DbSet<pk_guid> table)
74
+        protected override LuResult<bool> _Add(pk_guid model, PkGuidAddDbo dbo, LuUtilsDbContext db, IQueryable<pk_guid> table)
74 75
         {
75 76
             if (dbo.SomeInt == 2424)
76 77
             {
@@ -83,7 +84,7 @@ namespace TestUtils.DataAccess
83 84
             return LuResult<bool>.Ok(true);
84 85
         }
85 86
 
86
-        protected override LuResult<bool> _EditSingleById(pk_guid model, PkGuidAddDbo update, LuUtilsDbContext db, DbSet<pk_guid> table)
87
+        protected override LuResult<bool> _EditSingleById(pk_guid model, PkGuidAddDbo update, LuUtilsDbContext db, IQueryable<pk_guid> table)
87 88
         {
88 89
             return LuResult<bool>.Ok(true);
89 90
         }

Loading…
Cancel
Save