This commit is contained in:
2020-05-03 21:21:14 +00:00
parent 7ad76dcc10
commit b9da7a45b6
4 changed files with 19 additions and 9 deletions

View File

@@ -123,8 +123,11 @@ namespace AyaNova.Models
.WithOne(i => i.User)
.HasForeignKey<Widget>(b => b.UserId)
.OnDelete(DeleteBehavior.NoAction);
//Workorder
modelBuilder.Entity<WorkOrderItem>()
.HasOne(p => p.WorkOrder)
.WithMany(b => b.WorkorderItems);
//-----------

View File

@@ -30,7 +30,7 @@ namespace AyaNova.Models
// 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
//is more efficient when there are many child collections (but when would that ever be desired for AyaNova?)and means no need to null check the collection
//https://stackoverflow.com/a/20773057/8939
private ICollection<TranslationItem> _translationItem;

View File

@@ -22,6 +22,8 @@ namespace AyaNova.Models
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//dependents
public List<WorkOrderItem> WorkorderItems { get; set; }
public WorkOrder()
{

View File

@@ -8,20 +8,25 @@ namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public partial class WorkOrderItem
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki {get;set;}
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//Principle
public int WorkorderId { get; set; }//fk
public WorkOrder WorkOrder { get; set; }
//Dependents
public WorkOrderItem()
{