Fix Incorrect datetime value: '0001-01-01 00:00:00' for column 'last_modified' at row 1

This commit is contained in:
Alexey Safronov 2020-08-10 20:17:00 +03:00
parent e860d1ab76
commit 98b69d6492
2 changed files with 9 additions and 3 deletions

View File

@ -382,9 +382,10 @@ namespace ASC.Core.Data
{
Id = key,
Tenant = tenant,
Value = data
Value = data,
LastModified = DateTime.UtcNow
};
TenantDbContext.CoreSettings.Add(settings);
TenantDbContext.AddOrUpdate(r => r.CoreSettings, settings);
}
TenantDbContext.SaveChanges();
tx.Commit();

View File

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
namespace ASC.Core.Common.EF.Model
{
[Table("core_settings")]
public class DbCoreSettings
public class DbCoreSettings : BaseEntity
{
public int Tenant { get; set; }
public string Id { get; set; }
@ -13,6 +13,11 @@ namespace ASC.Core.Common.EF.Model
[Column("last_modified")]
public DateTime LastModified { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, Id };
}
}
public static class CoreSettingsExtension