This commit is contained in:
@@ -15,7 +15,7 @@ namespace AyaNova.Models
|
||||
public virtual DbSet<UserOptions> UserOptions { get; set; }
|
||||
public virtual DbSet<License> License { get; set; }
|
||||
public virtual DbSet<Widget> Widget { get; set; }
|
||||
public virtual DbSet<FileAttachment> FileAttachment { get; set; }
|
||||
public virtual DbSet<FileAttachment> FileAttachment { get; set; }
|
||||
public virtual DbSet<OpsJob> OpsJob { get; set; }
|
||||
public virtual DbSet<OpsJobLog> OpsJobLog { get; set; }
|
||||
public virtual DbSet<Locale> Locale { get; set; }
|
||||
@@ -40,7 +40,7 @@ namespace AyaNova.Models
|
||||
{
|
||||
// Replace table names
|
||||
//entity.Relational().TableName = "a" + entity.Relational().TableName.ToLowerInvariant();
|
||||
entity.SetTableName( "a" + entity.GetTableName().ToLowerInvariant());
|
||||
entity.SetTableName("a" + entity.GetTableName().ToLowerInvariant());
|
||||
|
||||
// Replace column names
|
||||
foreach (var property in entity.GetProperties())
|
||||
@@ -53,7 +53,7 @@ namespace AyaNova.Models
|
||||
property.SetColumnType("xid");
|
||||
// property.Relational().ColumnName = "xmin";
|
||||
// property.Relational().ColumnType = "xid";
|
||||
property.ValueGenerated = ValueGenerated.OnAddOrUpdate;
|
||||
property.ValueGenerated = ValueGenerated.OnAddOrUpdate;
|
||||
property.IsConcurrencyToken = true;
|
||||
}
|
||||
else
|
||||
@@ -63,13 +63,13 @@ namespace AyaNova.Models
|
||||
foreach (var key in entity.GetKeys())
|
||||
{
|
||||
key.SetName(key.GetName().ToLowerInvariant());
|
||||
// key.Relational().Name = key.Relational().Name.ToLowerInvariant();
|
||||
// key.Relational().Name = key.Relational().Name.ToLowerInvariant();
|
||||
}
|
||||
|
||||
foreach (var key in entity.GetForeignKeys())
|
||||
{
|
||||
//key.Relational().Name = key.Relational().Name.ToLowerInvariant();
|
||||
|
||||
|
||||
key.SetConstraintName(key.GetConstraintName().ToLowerInvariant());
|
||||
}
|
||||
|
||||
@@ -95,6 +95,15 @@ namespace AyaNova.Models
|
||||
.HasForeignKey<UserOptions>(b => b.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);//Hopefully will delete the useroptions with the user?
|
||||
|
||||
//User->Widget this might be wrong
|
||||
modelBuilder.Entity<User>()
|
||||
.HasOne(p => p.Widget)
|
||||
.WithOne(i => i.User)
|
||||
.HasForeignKey<Widget>(b => b.UserId)
|
||||
.OnDelete(DeleteBehavior.NoAction);
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user