Locale -> Translation

This commit is contained in:
2020-03-06 19:36:36 +00:00
parent 884c834b3d
commit a234b3531d
58 changed files with 540 additions and 569 deletions

View File

@@ -15,8 +15,8 @@ namespace AyaNova.Models
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; }
public virtual DbSet<LocaleItem> LocaleItem { get; set; }
public virtual DbSet<Translation> Translation { get; set; }
public virtual DbSet<TranslationItem> TranslationItem { get; set; }
public virtual DbSet<DataListView> DataListView { get; set; }
public virtual DbSet<Tag> Tag { get; set; }
public virtual DbSet<FormCustom> FormCustom { get; set; }
@@ -82,9 +82,9 @@ namespace AyaNova.Models
modelBuilder.Entity<FileAttachment>().HasIndex(p => p.StoredFileName);
//Relationships
modelBuilder.Entity<Locale>()
.HasMany(c => c.LocaleItems)
.WithOne(e => e.Locale)
modelBuilder.Entity<Translation>()
.HasMany(c => c.TranslationItems)
.WithOne(e => e.Translation)
.IsRequired();//default delete behaviour is cascade when set to isrequired
modelBuilder.Entity<User>()

View File

@@ -7,7 +7,7 @@ using Newtonsoft.Json;
namespace AyaNova.Models
{
// [JsonObject(IsReference = true)]
public partial class Locale
public partial class Translation
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
@@ -18,7 +18,7 @@ namespace AyaNova.Models
public bool? Stock { get; set; }
public bool CjkIndex { get; set; }
//TODO: Defaults for user options locale settings:
//TODO: Defaults for user options translation settings:
// short date, short time formats
// currency symbol
//digit grouping separator symbol
@@ -27,18 +27,18 @@ namespace AyaNova.Models
//Relationship
//was this but..
// public ICollection<LocaleItem> LocaleItems { get; set; }
// public ICollection<TranslationItem> TranslationItems { get; set; }
//Not perhaps so useful here but this is a good way to lazy initialize collections which
//is more efficient when there are many child collections (workorder) and means no need to null check the collection
//https://stackoverflow.com/a/20773057/8939
private ICollection<LocaleItem> _localeItem;
public virtual ICollection<LocaleItem> LocaleItems
private ICollection<TranslationItem> _translationItem;
public virtual ICollection<TranslationItem> TranslationItems
{
get
{
return this._localeItem ?? (this._localeItem = new HashSet<LocaleItem>());
return this._translationItem ?? (this._translationItem = new HashSet<TranslationItem>());
}
}

View File

@@ -9,7 +9,7 @@ using Newtonsoft.Json;
namespace AyaNova.Models
{
public partial class LocaleItem
public partial class TranslationItem
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
@@ -19,10 +19,10 @@ namespace AyaNova.Models
[Required]
public string Display { get; set; }
public long LocaleId { get; set; }
public long TranslationId { get; set; }
//Relation
[JsonIgnore]
public Locale Locale { get; set; }
public Translation Translation { get; set; }
}
}

View File

@@ -23,7 +23,7 @@ namespace AyaNova.Models
[Required]
public AuthorizationRoles Roles { get; set; }
[Required]
public long LocaleId { get; set; }
public long TranslationId { get; set; }
public string DlKey { get; set; }
public DateTime? DlKeyExpire { get; set; }