This commit is contained in:
2018-09-05 23:05:43 +00:00
parent cd52c3e83f
commit 0a3c927429
6 changed files with 37 additions and 24 deletions

View File

@@ -52,7 +52,6 @@ namespace AyaNova.Models
}
else
property.Relational().ColumnName = property.Name.ToLowerInvariant();
}
foreach (var key in entity.GetKeys())
@@ -69,21 +68,21 @@ namespace AyaNova.Models
{
index.Relational().Name = index.Relational().Name.ToLowerInvariant();
}
}
//Indexes must be specified through fluent api unfortunately
modelBuilder.Entity<FileAttachment>().HasIndex(p => p.StoredFileName);
//Relationships
modelBuilder.Entity<Locale>()
.HasMany(c => c.LocaleItems)
.WithOne(e => e.Locale)
.IsRequired();//default delete behaviour is cascade when set to isrequired
modelBuilder.Entity<User>()
.HasOne(p => p.UserOptions)
.WithOne(i => i.User)
.HasForeignKey<UserOptions>(b => b.UserId);
//-----------