Browse Source

refactor; handle(single) methods; exception handler; lu result handling

tags/v0.1.0
Robin Thoni 8 years ago
parent
commit
5cfebbec43
29 changed files with 214 additions and 30 deletions
  1. 8
    4
      Luticate2.Auth/Controllers/LuAuthExtensions.cs
  2. 1
    0
      Luticate2.Auth/Dbo/Groups/LuGroupsAddDbo.cs
  3. 1
    0
      Luticate2.Auth/Dbo/Groups/LuGroupsDbo.cs
  4. 1
    0
      Luticate2.Auth/Dbo/Users/UsersDbo.cs
  5. 2
    0
      Luticate2.Utils/Business/LuCrudBusiness.cs
  6. 18
    3
      Luticate2.Utils/Controllers/LuController.cs
  7. 10
    8
      Luticate2.Utils/Controllers/LuCrudController.cs
  8. 16
    0
      Luticate2.Utils/Controllers/LuResultException.cs
  9. 57
    1
      Luticate2.Utils/Controllers/LuUtilsExtensions.cs
  10. 16
    4
      Luticate2.Utils/DataAccess/LuEfCrudDataAccess.cs
  11. 1
    0
      Luticate2.Utils/DataAccess/LuEfDataAccess.cs
  12. 11
    0
      Luticate2.Utils/Dbo/Basic/LuApiWrapperDbo.cs
  13. 1
    1
      Luticate2.Utils/Dbo/Basic/LuBoxedValueDbo.cs
  14. 1
    1
      Luticate2.Utils/Dbo/Basic/LuDbo.cs
  15. 1
    1
      Luticate2.Utils/Dbo/Basic/LuPaginatedDbo.cs
  16. 1
    0
      Luticate2.Utils/Dbo/OrderBy/LuOrderByBinder.cs
  17. 1
    1
      Luticate2.Utils/Dbo/Result/LuResult.cs
  18. 1
    1
      Luticate2.Utils/Dbo/Result/LuStatus.cs
  19. 2
    0
      Luticate2.Utils/Interfaces/ILuCrudInterface.cs
  20. 53
    0
      Luticate2.Utils/Middlewares/LuExceptionMiddleware.cs
  21. 1
    1
      Luticate2.Utils/Utils/LuCoreUtilsExtensions.cs
  22. 1
    0
      Test/Utils/Binders/LuOrderByBinderTest.cs
  23. 1
    0
      Test/Utils/EfCrudDataAccess/LuEfCreateDataAccessTest.cs
  24. 1
    0
      Test/Utils/EfCrudDataAccess/LuEfDeleteDataAccessTest.cs
  25. 1
    0
      Test/Utils/EfCrudDataAccess/LuEfReadDataAccessTest.cs
  26. 1
    0
      Test/Utils/EfCrudDataAccess/LuEfUpdateDataAccessTest.cs
  27. 1
    0
      WebTest/Business/PkGuidBusiness.cs
  28. 1
    1
      WebTest/Controllers/PkGuidController.cs
  29. 3
    3
      WebTest/Startup.cs

Luticate2.Auth/Controllers/LuticateExtensions.cs → Luticate2.Auth/Controllers/LuAuthExtensions.cs View File

@@ -11,10 +11,12 @@ using Microsoft.Extensions.DependencyInjection;
11 11
 
12 12
 namespace Luticate2.Auth.Controllers
13 13
 {
14
-    public static class LuticateExtensions
14
+    public static class LuAuthExtensions
15 15
     {
16
-        public static IServiceCollection AddLuticate(this IServiceCollection services)
16
+        public static IServiceCollection AddLuticateAuth(this IServiceCollection services)
17 17
         {
18
+            services.AddLuticatUtils();
19
+
18 20
             services.AddSingleton<LuGroupsController>();
19 21
             services.AddSingleton<LuGroupsBusiness>();
20 22
             services.AddSingleton<LuGroupsDataAccess>();
@@ -26,8 +28,9 @@ namespace Luticate2.Auth.Controllers
26 28
             return services;
27 29
         }
28 30
 
29
-        public static IMvcBuilder AddLuticate(this IMvcBuilder builder)
31
+        public static IMvcBuilder AddLuticateAuth(this IMvcBuilder builder)
30 32
         {
33
+            builder.AddLuticatUtils();
31 34
 //            builder.AddApplicationPart(typeof(LuController).GetTypeInfo().Assembly)
32 35
 //                .AddControllersAsServices();
33 36
             builder.Services.Configure<MvcOptions>(
@@ -35,8 +38,9 @@ namespace Luticate2.Auth.Controllers
35 38
             return builder;
36 39
         }
37 40
 
38
-        public static IApplicationBuilder UseLuticate(this IApplicationBuilder app)
41
+        public static IApplicationBuilder UseLuticateAuth(this IApplicationBuilder app)
39 42
         {
43
+            app.UseLuticateUtils();
40 44
             app.UseMiddleware<LuAuthMiddleware>();
41 45
             return app;
42 46
         }

+ 1
- 0
Luticate2.Auth/Dbo/Groups/LuGroupsAddDbo.cs View File

@@ -1,4 +1,5 @@
1 1
 using Luticate2.Utils.Dbo;
2
+using Luticate2.Utils.Dbo.Basic;
2 3
 
3 4
 namespace Luticate2.Auth.Dbo.Groups
4 5
 {

+ 1
- 0
Luticate2.Auth/Dbo/Groups/LuGroupsDbo.cs View File

@@ -1,4 +1,5 @@
1 1
 using Luticate2.Utils.Dbo;
2
+using Luticate2.Utils.Dbo.Basic;
2 3
 
3 4
 namespace Luticate2.Auth.Dbo.Groups
4 5
 {

+ 1
- 0
Luticate2.Auth/Dbo/Users/UsersDbo.cs View File

@@ -1,4 +1,5 @@
1 1
 using Luticate2.Utils.Dbo;
2
+using Luticate2.Utils.Dbo.Basic;
2 3
 
3 4
 namespace Luticate2.Auth.Dbo.Users
4 5
 {

+ 2
- 0
Luticate2.Utils/Business/LuCrudBusiness.cs View File

@@ -1,7 +1,9 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using Luticate2.Utils.Dbo;
4
+using Luticate2.Utils.Dbo.Basic;
4 5
 using Luticate2.Utils.Dbo.OrderBy;
6
+using Luticate2.Utils.Dbo.Result;
5 7
 using Luticate2.Utils.Interfaces;
6 8
 
7 9
 namespace Luticate2.Utils.Business

+ 18
- 3
Luticate2.Utils/Controllers/LuController.cs View File

@@ -1,5 +1,7 @@
1 1
 using System.Collections.Generic;
2 2
 using Luticate2.Utils.Dbo;
3
+using Luticate2.Utils.Dbo.Basic;
4
+using Luticate2.Utils.Dbo.Result;
3 5
 using Microsoft.AspNetCore.Mvc;
4 6
 using Microsoft.AspNetCore.SignalR.Infrastructure;
5 7
 
@@ -11,13 +13,26 @@ namespace Luticate2.Utils.Controllers
11 13
 
12 14
         protected IDictionary<object, object> LuItems => HttpContext.GetLuItems();
13 15
 
14
-        protected T Handle<T>(LuResult<T> result)
16
+        protected LuApiWrapperDbo<T> Handle<T>(LuResult<T> result)
15 17
         {
16 18
             if (result)
17 19
             {
18
-                return result.Data;
20
+                return new LuApiWrapperDbo<T>
21
+                {
22
+                    Code = 200,
23
+                    Data = result.Data,
24
+                    Message = null
25
+                };
19 26
             }
20
-            return default(T);//TODO
27
+            throw new LuResultException(result.To<object>());
28
+        }
29
+
30
+        protected LuApiWrapperDbo<LuBoxedValueDbo<T>> HandleBoxed<T>(LuResult<T> result)
31
+        {
32
+            return Handle(result.To(arg => new LuBoxedValueDbo<T>
33
+            {
34
+                Value = arg
35
+            }));
21 36
         }
22 37
     }
23 38
 }

+ 10
- 8
Luticate2.Utils/Controllers/LuCrudController.cs View File

@@ -1,53 +1,55 @@
1 1
 using Luticate2.Utils.Dbo;
2
+using Luticate2.Utils.Dbo.Basic;
2 3
 using Luticate2.Utils.Dbo.OrderBy;
3 4
 using Luticate2.Utils.Interfaces;
4 5
 using Microsoft.AspNetCore.Mvc;
5 6
 
6 7
 namespace Luticate2.Utils.Controllers
7 8
 {
8
-    public abstract class LuCrudController<TDboCreate, TDboRead, TDboUpdate> : LuController
9
+    public abstract class LuCrudController<TBusiness, TDboCreate, TDboRead, TDboUpdate> : LuController
9 10
         where TDboCreate : class
10 11
         where TDboRead : class
11 12
         where TDboUpdate : class
13
+        where TBusiness : ILuCrudInterface<TDboCreate, TDboRead, TDboUpdate>
12 14
     {
13
-        protected readonly ILuCrudInterface<TDboCreate, TDboRead, TDboUpdate> Busines;
15
+        protected readonly TBusiness Busines;
14 16
 
15
-        protected LuCrudController(ILuCrudInterface<TDboCreate, TDboRead, TDboUpdate> busines)
17
+        protected LuCrudController(TBusiness busines)
16 18
         {
17 19
             Busines = busines;
18 20
         }
19 21
 
20 22
         [HttpGet]
21 23
         [Route("[controller]/{id}")]
22
-        public TDboRead GetSingleById(string id)
24
+        public LuApiWrapperDbo<TDboRead> GetSingleById(string id)
23 25
         {
24 26
             return Handle(Busines.GetSingleById(id));
25 27
         }
26 28
 
27 29
         [HttpGet]
28 30
         [Route("[controller]")]
29
-        public LuPaginatedDbo<TDboRead> GetMultiple(LuOrderByDbo orderBy, int page = 0, int perPage = int.MaxValue)
31
+        public LuApiWrapperDbo<LuPaginatedDbo<TDboRead>> GetMultiple(LuOrderByDbo orderBy, int page = 0, int perPage = int.MaxValue)
30 32
         {
31 33
             return Handle(Busines.GetMultiple(orderBy, page, perPage));
32 34
         }
33 35
 
34 36
         [HttpPost]
35 37
         [Route("[controller]")]
36
-        public TDboRead Add([FromBody]TDboCreate data)
38
+        public LuApiWrapperDbo<TDboRead> Add([FromBody]TDboCreate data)
37 39
         {
38 40
             return Handle(Busines.AddDbo(data));
39 41
         }
40 42
 
41 43
         [HttpPost]
42 44
         [Route("[controller]/{id}")]
43
-        public TDboRead Edit(string id, [FromBody]TDboUpdate data)
45
+        public LuApiWrapperDbo<TDboRead> Edit(string id, [FromBody]TDboUpdate data)
44 46
         {
45 47
             return Handle(Busines.EditSingleByIdDbo(id, data));
46 48
         }
47 49
 
48 50
         [HttpDelete]
49 51
         [Route("[controller]/{id}")]
50
-        public TDboRead Delete(string id)
52
+        public LuApiWrapperDbo<TDboRead> Delete(string id)
51 53
         {
52 54
             return Handle(Busines.DeleteSingleByIdDbo(id));
53 55
         }

+ 16
- 0
Luticate2.Utils/Controllers/LuResultException.cs View File

@@ -0,0 +1,16 @@
1
+using System;
2
+using Luticate2.Utils.Dbo;
3
+using Luticate2.Utils.Dbo.Result;
4
+
5
+namespace Luticate2.Utils.Controllers
6
+{
7
+    public class LuResultException : Exception
8
+    {
9
+        public LuResult<object> Result { get; set; }
10
+
11
+        public LuResultException(LuResult<object> result) : base(result.PrivateDetails, result.Exception)
12
+        {
13
+            Result = result;
14
+        }
15
+    }
16
+}

+ 57
- 1
Luticate2.Utils/Controllers/LuUtilsExtensions.cs View File

@@ -1,10 +1,66 @@
1 1
 using System.Collections.Generic;
2
+using Luticate2.Utils.Dbo;
3
+using Luticate2.Utils.Dbo.Result;
4
+using Luticate2.Utils.Middlewares;
5
+using Microsoft.AspNetCore.Builder;
2 6
 using Microsoft.AspNetCore.Http;
7
+using Microsoft.Extensions.DependencyInjection;
3 8
 
4 9
 namespace Luticate2.Utils.Controllers
5 10
 {
6
-    public static class LuControllerUtilsExtensions
11
+    public static class LuUtilsExtensions
7 12
     {
13
+        public static IServiceCollection AddLuticatUtils(this IServiceCollection services)
14
+        {
15
+
16
+            return services;
17
+        }
18
+
19
+        public static IMvcBuilder AddLuticatUtils(this IMvcBuilder builder)
20
+        {
21
+            return builder;
22
+        }
23
+
24
+        public static IApplicationBuilder UseLuticateUtils(this IApplicationBuilder app)
25
+        {
26
+//            app.UseMiddleware<LuAuthMiddleware>();
27
+            app.UseMiddleware<LuExceptionMiddleware>();
28
+            return app;
29
+        }
30
+
31
+        public static int GetHttpCode<T>(this LuResult<T> result)
32
+        {
33
+            if (result.Status == LuStatus.Success)
34
+            {
35
+                return 200;
36
+            }
37
+            if (result.Status == LuStatus.InputError)
38
+            {
39
+                return 400;
40
+            }
41
+            if (result.Status == LuStatus.LoginError)
42
+            {
43
+                return 401;
44
+            }
45
+            if (result.Status == LuStatus.PermissionError)
46
+            {
47
+                return 403;
48
+            }
49
+            if (result.Status == LuStatus.NotFound)
50
+            {
51
+                return 404;
52
+            }
53
+            if (result.Status == LuStatus.DbError)
54
+            {
55
+                return 500;
56
+            }
57
+            if (result.Status == LuStatus.InternalError)
58
+            {
59
+                return 500;
60
+            }
61
+            return 418;
62
+        }
63
+
8 64
         public static IDictionary<object, object> GetLuItems(this HttpContext context)
9 65
         {
10 66
             return (IDictionary<object, object>) context.Items["luticateItems"];

+ 16
- 4
Luticate2.Utils/DataAccess/LuEfCrudDataAccess.cs View File

@@ -4,7 +4,9 @@ using System.Linq;
4 4
 using System.Linq.Expressions;
5 5
 using System.Reflection;
6 6
 using Luticate2.Utils.Dbo;
7
+using Luticate2.Utils.Dbo.Basic;
7 8
 using Luticate2.Utils.Dbo.OrderBy;
9
+using Luticate2.Utils.Dbo.Result;
8 10
 using Luticate2.Utils.Interfaces;
9 11
 using Luticate2.Utils.Utils;
10 12
 using Microsoft.EntityFrameworkCore;
@@ -58,6 +60,16 @@ namespace Luticate2.Utils.DataAccess
58 60
             return model;
59 61
         }
60 62
 
63
+        protected Guid GetGuid(string id)
64
+        {
65
+            Guid guid;
66
+            if (Guid.TryParse(id, out guid))
67
+            {
68
+                return guid;
69
+            }
70
+            return new Guid();
71
+        }
72
+
61 73
 
62 74
 
63 75
 
@@ -138,7 +150,7 @@ namespace Luticate2.Utils.DataAccess
138 150
 
139 151
         public LuResult<TDboRead> GetSingleById(string id)
140 152
         {
141
-            return GetSingleByKeys(new KeyValuePair<string, object>("id", new Guid(id)));
153
+            return GetSingleByKeys(new KeyValuePair<string, object>("id", GetGuid(id)));
142 154
         }
143 155
 
144 156
         public LuResult<TDboRead> GetSingleById(long id)
@@ -283,7 +295,7 @@ namespace Luticate2.Utils.DataAccess
283 295
 
284 296
         public LuResult<T> EditSingleById<T>(string id, Action<TModel> update, Func<TDboRead, T> returnFunc)
285 297
         {
286
-            return Edit(GetExpression(new KeyValuePair<string, object>("id", new Guid(id))), update,
298
+            return Edit(GetExpression(new KeyValuePair<string, object>("id", GetGuid(id))), update,
287 299
                 list => returnFunc(list.FirstOrDefault()));
288 300
         }
289 301
 
@@ -317,7 +329,7 @@ namespace Luticate2.Utils.DataAccess
317 329
 
318 330
         public LuResult<T> EditSingleById<T>(string id, TDboUpdate update, Func<TDboRead, T> returnFunc)
319 331
         {
320
-            return Edit(GetExpression(new KeyValuePair<string, object>("id", new Guid(id))),
332
+            return Edit(GetExpression(new KeyValuePair<string, object>("id", GetGuid(id))),
321 333
                 model => EditModelFromTUpdate(update, model), list => returnFunc(list.FirstOrDefault()));
322 334
         }
323 335
 
@@ -367,7 +379,7 @@ namespace Luticate2.Utils.DataAccess
367 379
 
368 380
         public LuResult<T> DeleteSingleById<T>(string id, Func<TDboRead, T> returnFunc)
369 381
         {
370
-            return Delete(GetExpression(new KeyValuePair<string, object>("id", new Guid(id))),
382
+            return Delete(GetExpression(new KeyValuePair<string, object>("id", GetGuid(id))),
371 383
                 reads => returnFunc(reads.First()));
372 384
         }
373 385
 

+ 1
- 0
Luticate2.Utils/DataAccess/LuEfDataAccess.cs View File

@@ -2,6 +2,7 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Linq.Expressions;
4 4
 using Luticate2.Utils.Dbo;
5
+using Luticate2.Utils.Dbo.Result;
5 6
 using Microsoft.EntityFrameworkCore;
6 7
 
7 8
 namespace Luticate2.Utils.DataAccess

+ 11
- 0
Luticate2.Utils/Dbo/Basic/LuApiWrapperDbo.cs View File

@@ -0,0 +1,11 @@
1
+namespace Luticate2.Utils.Dbo.Basic
2
+{
3
+    public class LuApiWrapperDbo<T>
4
+    {
5
+        public int Code { get; set; }
6
+
7
+        public string Message { get; set; }
8
+
9
+        public T Data { get; set; }
10
+    }
11
+}

+ 1
- 1
Luticate2.Utils/Dbo/Basic/LuBoxedValueDbo.cs View File

@@ -1,4 +1,4 @@
1
-namespace Luticate2.Utils.Dbo
1
+namespace Luticate2.Utils.Dbo.Basic
2 2
 {
3 3
     public class LuBoxedValueDbo<T> : LuDbo
4 4
     {

+ 1
- 1
Luticate2.Utils/Dbo/Basic/LuDbo.cs View File

@@ -1,4 +1,4 @@
1
-namespace Luticate2.Utils.Dbo
1
+namespace Luticate2.Utils.Dbo.Basic
2 2
 {
3 3
     public class LuDbo
4 4
     {

+ 1
- 1
Luticate2.Utils/Dbo/Basic/LuPaginatedDbo.cs View File

@@ -1,6 +1,6 @@
1 1
 using System.Collections.Generic;
2 2
 
3
-namespace Luticate2.Utils.Dbo
3
+namespace Luticate2.Utils.Dbo.Basic
4 4
 {
5 5
     public class LuPaginatedDbo<TDbo> : LuDbo
6 6
     {

+ 1
- 0
Luticate2.Utils/Dbo/OrderBy/LuOrderByBinder.cs View File

@@ -1,5 +1,6 @@
1 1
 using System.Collections.Generic;
2 2
 using System.Threading.Tasks;
3
+using Luticate2.Utils.Dbo.Result;
3 4
 using Microsoft.AspNetCore.Mvc.ModelBinding;
4 5
 
5 6
 namespace Luticate2.Utils.Dbo.OrderBy

+ 1
- 1
Luticate2.Utils/Dbo/Result/LuResult.cs View File

@@ -1,6 +1,6 @@
1 1
 using System;
2 2
 
3
-namespace Luticate2.Utils.Dbo
3
+namespace Luticate2.Utils.Dbo.Result
4 4
 {
5 5
     public class LuResult<T>
6 6
     {

+ 1
- 1
Luticate2.Utils/Dbo/Result/LuStatus.cs View File

@@ -1,4 +1,4 @@
1
-namespace Luticate2.Utils.Dbo
1
+namespace Luticate2.Utils.Dbo.Result
2 2
 {
3 3
     public enum LuStatus
4 4
     {

+ 2
- 0
Luticate2.Utils/Interfaces/ILuCrudInterface.cs View File

@@ -1,7 +1,9 @@
1 1
 using System;
2 2
 using System.Collections.Generic;
3 3
 using Luticate2.Utils.Dbo;
4
+using Luticate2.Utils.Dbo.Basic;
4 5
 using Luticate2.Utils.Dbo.OrderBy;
6
+using Luticate2.Utils.Dbo.Result;
5 7
 
6 8
 namespace Luticate2.Utils.Interfaces
7 9
 {

+ 53
- 0
Luticate2.Utils/Middlewares/LuExceptionMiddleware.cs View File

@@ -0,0 +1,53 @@
1
+using System;
2
+using System.Threading.Tasks;
3
+using Luticate2.Utils.Controllers;
4
+using Luticate2.Utils.Dbo.Basic;
5
+using Microsoft.AspNetCore.Http;
6
+using Microsoft.AspNetCore.Mvc.Infrastructure;
7
+using Newtonsoft.Json;
8
+
9
+namespace Luticate2.Utils.Middlewares
10
+{
11
+    public class LuExceptionMiddleware
12
+    {
13
+        private readonly RequestDelegate _next;
14
+
15
+        public LuExceptionMiddleware(RequestDelegate next,
16
+            IActionDescriptorCollectionProvider actionDescriptorCollectionProvider)
17
+        {
18
+            _next = next;
19
+        }
20
+
21
+        public async Task Invoke(HttpContext context)
22
+        {
23
+            try
24
+            {
25
+                await _next.Invoke(context);
26
+            }
27
+            catch (LuResultException e)
28
+            {
29
+                var response = context.Response;
30
+                response.ContentType = "application/json";
31
+                response.StatusCode = e.Result.GetHttpCode();
32
+                await response.WriteAsync(JsonConvert.SerializeObject(new LuApiWrapperDbo<object>
33
+                {
34
+                    Code = e.Result.GetHttpCode(),
35
+                    Data = null,
36
+                    Message = e.Result.PublicDetails
37
+                })).ConfigureAwait(false);
38
+            }
39
+            catch (Exception e)
40
+            {
41
+                var response = context.Response;
42
+                response.ContentType = "application/json";
43
+                response.StatusCode = 500;
44
+                await response.WriteAsync(JsonConvert.SerializeObject(new LuApiWrapperDbo<object>
45
+                {
46
+                    Code = 500,
47
+                    Data = null,
48
+                    Message = "Internal Error"
49
+                })).ConfigureAwait(false);
50
+            }
51
+        }
52
+    }
53
+}

Luticate2.Utils/Utils/LuUtilsExtension.cs → Luticate2.Utils/Utils/LuCoreUtilsExtensions.cs View File

@@ -4,7 +4,7 @@ using System.Reflection;
4 4
 
5 5
 namespace Luticate2.Utils.Utils
6 6
 {
7
-    public static class LuUtilsExtension
7
+    public static class LuCoreUtilsExtensions
8 8
     {
9 9
         public static string ToSnakeCase(this string str)
10 10
         {

+ 1
- 0
Test/Utils/Binders/LuOrderByBinderTest.cs View File

@@ -1,6 +1,7 @@
1 1
 using System.Linq;
2 2
 using Luticate2.Utils.Dbo;
3 3
 using Luticate2.Utils.Dbo.OrderBy;
4
+using Luticate2.Utils.Dbo.Result;
4 5
 using Xunit;
5 6
 
6 7
 namespace Test.Utils.Binders

+ 1
- 0
Test/Utils/EfCrudDataAccess/LuEfCreateDataAccessTest.cs View File

@@ -2,6 +2,7 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using Luticate2.Utils.Dbo;
5
+using Luticate2.Utils.Dbo.Result;
5 6
 using Test.Utils.DataAccess;
6 7
 using Test.Utils.Dbo.PkBigSerial;
7 8
 using Test.Utils.Dbo.PkGuid;

+ 1
- 0
Test/Utils/EfCrudDataAccess/LuEfDeleteDataAccessTest.cs View File

@@ -2,6 +2,7 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using Luticate2.Utils.Dbo;
5
+using Luticate2.Utils.Dbo.Result;
5 6
 using Test.Utils.DataAccess;
6 7
 using Test.Utils.Dbo.PkBigSerial;
7 8
 using Test.Utils.Dbo.PkGuid;

+ 1
- 0
Test/Utils/EfCrudDataAccess/LuEfReadDataAccessTest.cs View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using Luticate2.Utils.Dbo;
5 5
 using Luticate2.Utils.Dbo.OrderBy;
6
+using Luticate2.Utils.Dbo.Result;
6 7
 using Test.Utils.DataAccess;
7 8
 using Test.Utils.Dbo.PkBigSerial;
8 9
 using Test.Utils.Dbo.PkGuid;

+ 1
- 0
Test/Utils/EfCrudDataAccess/LuEfUpdateDataAccessTest.cs View File

@@ -2,6 +2,7 @@
2 2
 using System.Collections.Generic;
3 3
 using System.Linq;
4 4
 using Luticate2.Utils.Dbo;
5
+using Luticate2.Utils.Dbo.Result;
5 6
 using Test.Utils.DataAccess;
6 7
 using Test.Utils.Dbo.PkBigSerial;
7 8
 using Test.Utils.Dbo.PkGuid;

+ 1
- 0
WebTest/Business/PkGuidBusiness.cs View File

@@ -1,5 +1,6 @@
1 1
 using Luticate2.Utils.Business;
2 2
 using Luticate2.Utils.Dbo;
3
+using Luticate2.Utils.Dbo.Result;
3 4
 using Test.Utils.DataAccess;
4 5
 using Test.Utils.Dbo.PkGuid;
5 6
 

+ 1
- 1
WebTest/Controllers/PkGuidController.cs View File

@@ -4,7 +4,7 @@ using WebTest.Business;
4 4
 
5 5
 namespace WebTest.Controllers
6 6
 {
7
-    public class PkGuidController : LuCrudController<PkGuidAddDbo, PkGuidDbo, PkGuidAddDbo>
7
+    public class PkGuidController : LuCrudController<PkGuidBusiness, PkGuidAddDbo, PkGuidDbo, PkGuidAddDbo>
8 8
     {
9 9
         public PkGuidController(PkGuidBusiness busines) : base(busines)
10 10
         {

+ 3
- 3
WebTest/Startup.cs View File

@@ -38,14 +38,14 @@ namespace WebTest
38 38
             // Add framework services.
39 39
             services.AddApplicationInsightsTelemetry(Configuration);
40 40
 
41
-            services.AddLuticate();
41
+            services.AddLuticateAuth();
42 42
 
43 43
             services.AddSingleton<PkGuidBusiness>();
44 44
             services.AddSingleton<LuUtilsPkGuidDataAccess>();
45 45
             services.AddDbContext<LuUtilsDbContext>(options => options.UseNpgsql(Tests.ConnectionString));
46 46
 
47 47
             services.AddMvc()
48
-                .AddLuticate();
48
+                .AddLuticateAuth();
49 49
         }
50 50
 
51 51
         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
@@ -58,7 +58,7 @@ namespace WebTest
58 58
 
59 59
             app.UseApplicationInsightsExceptionTelemetry();
60 60
 
61
-            app.UseLuticate();
61
+            app.UseLuticateAuth();
62 62
 
63 63
             app.UseMvc();
64 64
         }

Loading…
Cancel
Save