Skip to content

Commit 632a023

Browse files
committed
add option to turn off temporal table mapping, add script template merge, add rowversion options
1 parent d57d802 commit 632a023

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+347
-131
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ Entity Framework Core Generator supports generating [Read](https://efg.loresoft.
155155

156156
## Change Log
157157

158+
### Version 6.0
159+
160+
- upgrade to .net 8
161+
- add option to turn off temporal table mapping
162+
- add rowversion options, ByteArray|Long|ULong
163+
- add script template merge
164+
158165
### Version 5.0
159166

160167
- add support for navigation property renames

docs/configuration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ data:
102102
directory: '{Project.Directory}\Data\Mapping' # the mapping class output directory
103103
#include XML documentation
104104
document: false
105+
106+
temporal: false # if temporal table mapping is enabled. Default true
107+
rowVersion: ByteArray|Long|ULong # How row versions should be mapped. Default ByteArray
105108

106109
# query extension class file configuration
107110
query:
@@ -191,6 +194,7 @@ script:
191194
namespace: '{Project.Namespace}.Domain.Context'
192195
baseClass: ContextScriptBase
193196
overwrite: true # overwrite existing file
197+
merge: true # merge regions with existing file
194198
# collection of script template with current Entity as a variable
195199
entity:
196200
- templatePath: '.\templates\entity.csx' # path to script file
@@ -199,6 +203,7 @@ script:
199203
namespace: '{Project.Namespace}.Domain.Entity'
200204
baseClass: EntityScriptBase
201205
overwrite: true # overwrite existing file
206+
merge: true # merge regions with existing file
202207
# collection script template with current Model as a variable
203208
model:
204209
- templatePath: '.\templates\model.csx' # path to script file
@@ -207,10 +212,12 @@ script:
207212
namespace: '{Project.Namespace}.Domain.Models'
208213
baseClass: ModelScriptBase
209214
overwrite: true # overwrite existing file
215+
merge: true # merge regions with existing file
210216
- templatePath: '.\templates\sample.csx' # path to script file
211217
fileName: '{Model.Name}Sample.cs' # filename to save script output
212218
directory: '{Project.Directory}\Domain\Models' # directory to save script output
213219
namespace: '{Project.Namespace}.Domain.Models'
214220
baseClass: ModelSampleBase
215221
overwrite: true # overwrite existing file
222+
merge: true # merge regions with existing file
216223
```

sample/Tracker/Tracker.Core/Data/Mapping/AuditMap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
7979
builder.Property(t => t.RowVersion)
8080
.IsRequired()
8181
.IsRowVersion()
82+
.IsConcurrencyToken()
8283
.HasColumnName("RowVersion")
8384
.HasColumnType("rowversion")
8485
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/PriorityMap.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
4444
builder.Property(t => t.DisplayOrder)
4545
.IsRequired()
4646
.HasColumnName("DisplayOrder")
47-
.HasColumnType("int");
47+
.HasColumnType("int")
48+
.HasDefaultValue(0);
4849

4950
builder.Property(t => t.IsActive)
5051
.IsRequired()
5152
.HasColumnName("IsActive")
5253
.HasColumnType("bit")
53-
.HasDefaultValueSql("((1))");
54+
.HasDefaultValue(true);
5455

5556
builder.Property(t => t.Created)
5657
.IsRequired()
@@ -77,6 +78,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
7778
builder.Property(t => t.RowVersion)
7879
.IsRequired()
7980
.IsRowVersion()
81+
.IsConcurrencyToken()
8082
.HasColumnName("RowVersion")
8183
.HasColumnType("rowversion")
8284
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/RoleMap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
6565
builder.Property(t => t.RowVersion)
6666
.IsRequired()
6767
.IsRowVersion()
68+
.IsConcurrencyToken()
6869
.HasColumnName("RowVersion")
6970
.HasColumnType("rowversion")
7071
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/StatusMap.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
4444
builder.Property(t => t.DisplayOrder)
4545
.IsRequired()
4646
.HasColumnName("DisplayOrder")
47-
.HasColumnType("int");
47+
.HasColumnType("int")
48+
.HasDefaultValueSql("((0))");
4849

4950
builder.Property(t => t.IsActive)
5051
.IsRequired()
5152
.HasColumnName("IsActive")
5253
.HasColumnType("bit")
53-
.HasDefaultValueSql("((1))");
54+
.HasDefaultValue(true);
5455

5556
builder.Property(t => t.Created)
5657
.IsRequired()
@@ -77,6 +78,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
7778
builder.Property(t => t.RowVersion)
7879
.IsRequired()
7980
.IsRowVersion()
81+
.IsConcurrencyToken()
8082
.HasColumnName("RowVersion")
8183
.HasColumnType("rowversion")
8284
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/TaskExtendedMap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
6868
builder.Property(t => t.RowVersion)
6969
.IsRequired()
7070
.IsRowVersion()
71+
.IsConcurrencyToken()
7172
.HasColumnName("RowVersion")
7273
.HasColumnType("rowversion")
7374
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/TaskMap.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
108108
builder.Property(t => t.RowVersion)
109109
.IsRequired()
110110
.IsRowVersion()
111+
.IsConcurrencyToken()
111112
.HasColumnName("RowVersion")
112113
.HasColumnType("rowversion")
113114
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/TenantMap.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
4444
.IsRequired()
4545
.HasColumnName("IsActive")
4646
.HasColumnType("bit")
47-
.HasDefaultValueSql("((1))");
47+
.HasDefaultValue(true);
4848

4949
builder.Property(t => t.Created)
5050
.IsRequired()
@@ -71,6 +71,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
7171
builder.Property(t => t.RowVersion)
7272
.IsRequired()
7373
.IsRowVersion()
74+
.IsConcurrencyToken()
7475
.HasColumnName("RowVersion")
7576
.HasColumnType("rowversion")
7677
.HasMaxLength(8)

sample/Tracker/Tracker.Core/Data/Mapping/UserLoginMap.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
7777
builder.Property(t => t.IsSuccessful)
7878
.IsRequired()
7979
.HasColumnName("IsSuccessful")
80-
.HasColumnType("bit");
80+
.HasColumnType("bit")
81+
.HasDefaultValue(false);
8182

8283
builder.Property(t => t.FailureMessage)
8384
.HasColumnName("FailureMessage")
@@ -109,6 +110,7 @@ public void Configure(Microsoft.EntityFrameworkCore.Metadata.Builders.EntityType
109110
builder.Property(t => t.RowVersion)
110111
.IsRequired()
111112
.IsRowVersion()
113+
.IsConcurrencyToken()
112114
.HasColumnName("RowVersion")
113115
.HasColumnType("rowversion")
114116
.HasMaxLength(8)

0 commit comments

Comments
 (0)