See comments for what was my solution
I am new with ASP.net and i'm currently making a website.
This site is creating with MVC in mind. I have created a database containing a few tables.
As you can see are Shipments referenced in processOrder ( 1 --* ) and there are a few more references like this (Mandator and Customer). I think this is no problem?
At the client side i'm using jquery datatables to show my data:
I had no trouble before but since i started server side processing of my data (For optimization purpose) i have some trouble accessing my data. I created a method so the datatable can receive the data in json format:
Since then I keep having self referencing problems in processOrder for shipment type. I tried a few things in this post: JSON.NET Error Self referencing loop detected for type but the closest I got was with fix 2 of the second answer. The only problem with that solution is the "$ref" that my datatable cant understand.
I hope someone can get me back on the right track with a solution or tip
EDIT: Added the entity ProcessOrder. It is auto generated from the database. `
namespace ICT.ControlTower.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class ProcessOrder
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public ProcessOrder()
{
this.Shipment = new HashSet<Shipment>();
this.StockItem = new HashSet<StockItem>();
}
public int Id { get; set; }
public System.DateTime InsertedAt { get; set; }
public int CustomerId { get; set; }
public int OrderStatus { get; set; }
public int MandatorId { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<Shipment> Shipment { get; set; }
public virtual Customer Customer { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<StockItem> StockItem { get; set; }
public virtual Mandator Mandator { get; set; }
}
}
`
namespace ICT.ControlTower.Domain.Entities
{
using System;
using System.Collections.Generic;
public partial class Customer
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Customer()
{
this.ProcessOrder = new HashSet<ProcessOrder>();
}
public int Id { get; set; }
public string Name { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<ProcessOrder> ProcessOrder { get; set; }
}
}