fix 新增时实体类ID赋值问题

This commit is contained in:
2021-05-07 13:24:16 +08:00
parent 18fd2b3cda
commit d087fe2852
2 changed files with 2 additions and 2 deletions

View File

@@ -112,7 +112,7 @@ namespace Ewide.EntityFramework.Core
var obj = entity.Entity as DEntityBase;
if (entity.State == EntityState.Added)
{
obj.Id = Guid.NewGuid().ToString();
obj.Id = string.IsNullOrEmpty(obj.Id) ? Guid.NewGuid().ToString() : obj.Id;
obj.CreatedTime = DateTime.Now;
if (!string.IsNullOrEmpty(userId))
{