Browse Source

added updated/deleted at columns

tags/v0.1.0
Robin Thoni 8 years ago
parent
commit
93a80d9928

+ 1
- 5
Luticate2.Utils/DataAccess/LuEfCrudDataAccess.cs View File

@@ -45,11 +45,7 @@ namespace Luticate2.Utils.DataAccess
45 45
 
46 46
         protected Func<TDboRead, T> GetIdFunc<T>()
47 47
         {
48
-            var param = Expression.Parameter(typeof(TDboRead), "x");
49
-            var exp = Expression.Property(param, "Id");
50
-            var lambda = Expression.Lambda<Func<TDboRead, T>>(exp, param);
51
-            var func = lambda.Compile();
52
-            return func;
48
+            return x => ((dynamic) x).Id;
53 49
         }
54 50
 
55 51
         protected TModel GetModelFromTUpdate(TDboUpdate obj, TModel model)

+ 1
- 1
Test/Utils/DataAccess/LuUtilsDbContext.cs View File

@@ -49,7 +49,7 @@ namespace Test.Utils.DataAccess
49 49
             
50 50
             modelBuilder.Entity<pk_guid>()
51 51
                 .Property(e => e.id)
52
-                .HasDefaultValueSql("uuid_generate_v1()");
52
+                .HasDefaultValueSql("get_uuid()");
53 53
             
54 54
             modelBuilder.Entity<pk_guid>()
55 55
                 .Property(e => e.created_at)

+ 1
- 0
Test/Utils/DataAccess/LuUtilsPkGuidDataAccess.cs View File

@@ -26,6 +26,7 @@ namespace Test.Utils.DataAccess
26 26
             return new PkGuidDbo
27 27
             {
28 28
                 CreatedAt = model.created_at,
29
+                UpdatedAt = model.updated_at,
29 30
                 Id = model.id.ToString(),
30 31
                 SomeInt = model.some_int,
31 32
                 SomeText = model.some_text

+ 2
- 0
Test/Utils/DataAccess/Models/pk_bigserial.cs View File

@@ -16,6 +16,8 @@ namespace Test.Utils.DataAccess.Models
16 16
         
17 17
         public DateTime created_at { get; set; }
18 18
         
19
+        public DateTime? updated_at { get; set; }
20
+        
19 21
         
20 22
         
21 23
     }

+ 2
- 0
Test/Utils/DataAccess/Models/pk_guid.cs View File

@@ -16,6 +16,8 @@ namespace Test.Utils.DataAccess.Models
16 16
         
17 17
         public DateTime created_at { get; set; }
18 18
         
19
+        public DateTime? updated_at { get; set; }
20
+        
19 21
         
20 22
         
21 23
     }

+ 29
- 0
Test/Utils/DataAccess/code-from-ds/code-from-ds.json View File

@@ -4,6 +4,27 @@
4 4
     "modelsRelativePath": "../../Test/Utils/DataAccess/Models",
5 5
     "selection": {
6 6
         "tables": [
7
+            {
8
+                "columns": [
9
+                    {
10
+                        "column": "id",
11
+                        "selected": false
12
+                    },
13
+                    {
14
+                        "column": "table",
15
+                        "selected": false
16
+                    },
17
+                    {
18
+                        "column": "data",
19
+                        "selected": false
20
+                    },
21
+                    {
22
+                        "column": "date",
23
+                        "selected": false
24
+                    }
25
+                ],
26
+                "table": "lu_entities_history"
27
+            },
7 28
             {
8 29
                 "columns": [
9 30
                     {
@@ -21,6 +42,10 @@
21 42
                     {
22 43
                         "column": "created_at",
23 44
                         "selected": true
45
+                    },
46
+                    {
47
+                        "column": "updated_at",
48
+                        "selected": true
24 49
                     }
25 50
                 ],
26 51
                 "table": "pk_bigserial"
@@ -42,6 +67,10 @@
42 67
                     {
43 68
                         "column": "created_at",
44 69
                         "selected": true
70
+                    },
71
+                    {
72
+                        "column": "updated_at",
73
+                        "selected": true
45 74
                     }
46 75
                 ],
47 76
                 "table": "pk_guid"

+ 2
- 0
Test/Utils/Dbo/PkGuid/PkGuidDbo.cs View File

@@ -11,5 +11,7 @@ namespace Test.Utils.Dbo.PkGuid
11 11
         public int? SomeInt { get; set; }
12 12
 
13 13
         public DateTime CreatedAt { get; set; }
14
+
15
+        public DateTime? UpdatedAt { get; set; }
14 16
     }
15 17
 }

Loading…
Cancel
Save