Skip to content

Commit a91bfe3

Browse files
Add audit UTC datetime + fix mysql schema
Add audit UTC datetime + fix mysql schema
1 parent 2a11016 commit a91bfe3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/shared/Z.EF.Plus.Audit.Shared/AuditConfiguration.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public AuditConfiguration()
4242
IsAuditedDictionary = new ConcurrentDictionary<string, bool>();
4343
ValueFormatterDictionary = new ConcurrentDictionary<string, Func<object, object>>();
4444

45-
UseCoordinatedUniversalTime = false;
45+
4646
#if EF5 || EF6
4747
UseNullForDBNullValue = true;
4848
#endif
@@ -131,7 +131,7 @@ public AuditConfiguration()
131131

132132
/// <summary>Gets or sets a value determining if Coordinated Universal Time (UTC) should be used instead of local time.</summary>
133133
/// <value>true if UTC, false if local</value>
134-
public bool UseCoordinatedUniversalTime { get; set; }
134+
public bool UseUtcDateTime { get; set; }
135135

136136
#if EF5 || EF6
137137
/// <summary>
@@ -167,7 +167,7 @@ public AuditConfiguration Clone()
167167
SoftAddedPredicates = new List<Func<object, bool>>(SoftAddedPredicates),
168168
SoftDeletedPredicates = new List<Func<object, bool>>(SoftDeletedPredicates),
169169
ExcludeRelationshipIfOneExcluded = ExcludeRelationshipIfOneExcluded,
170-
UseCoordinatedUniversalTime = UseCoordinatedUniversalTime,
170+
UseUtcDateTime = UseUtcDateTime,
171171
#if EF5 || EF6
172172
UseNullForDBNullValue = UseNullForDBNullValue
173173
#endif

src/shared/Z.EF.Plus.Audit.Shared/AuditEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void Build(Audit parent, EntityEntry entry)
3838

3939
if (CreatedDate == DateTime.MinValue)
4040
{
41-
CreatedDate = (parent.Configuration.UseCoordinatedUniversalTime) ? DateTime.UtcNow : DateTime.Now;
41+
CreatedDate = parent.CurrentOrDefaultConfiguration.UseUtcDateTime ? DateTime.UtcNow : DateTime.Now;
4242
}
4343

4444
if (Entry == null)

src/shared/Z.EF.Plus.BatchDelete.Shared/BatchDelete.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ internal DbCommand CreateCommand<T>(ObjectQuery query, SchemaEntityType<T> entit
427427

428428
if (isMySql)
429429
{
430-
tableName = string.IsNullOrEmpty(store.Schema) || store.Schema == "dbo" ?
430+
tableName = string.IsNullOrEmpty(store.Schema) || store.Schema == "dbo" || store.Table.StartsWith(store.Schema + ".")?
431431
string.Concat("`", store.Table, "`") :
432432
string.Concat("`", store.Schema, ".", store.Table, "`");
433433
}

src/shared/Z.EF.Plus.BatchUpdate.Shared/BatchUpdate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ internal DbCommand CreateCommand<T>(ObjectQuery query, SchemaEntityType<T> entit
427427

428428
if (isMySql)
429429
{
430-
tableName = string.IsNullOrEmpty(store.Schema) || store.Schema == "dbo" ?
430+
tableName = string.IsNullOrEmpty(store.Schema) || store.Schema == "dbo" || store.Table.StartsWith(store.Schema + ".") ?
431431
string.Concat("`", store.Table, "`") :
432432
string.Concat("`", store.Schema, ".", store.Table, "`");
433433
}

0 commit comments

Comments
 (0)