Hi,
I have generated a model from my database and two tables have a navigator to each other.
Table 1 -> Table 2
Table 2 -> Table 1
When I get data like this (using Prefetch):
using (DataAccessAdapter adapter = new DataAccessAdapter("Somestring"))
{
var query = new LinqMetaData(adapter);
var itemPath = new PrefetchPath2(EntityType.ItemEntity);
itemPath.Add(ItemEntity.PrefetchPathTable1).SubPath.Add(Table1Entity.PrefetchPathTable2);
var allItems = query.TableItem.WithPath(itemPath).ToList();
}
The resulting JSON looks something like this:
{
"table1":[
{
"table2":[
{
"table1":[
{
"table2":[
{
}
]
}
]
}
]
}
]
}
This results in a large amount of data which is not needed. The serialization is being configured like this:
services.AddMvc()
.AddJsonOptions(options => options.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects)
.AddJsonOptions(options => options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver() { IgnoreSerializableAttribute = true, IgnoreSerializableInterface = true });
The question is, is there any way to either tell the designer, that the navigator should be ignored when serializing or some way to add this to the above Prefetch call when using the generated code?
I have tried searching the forums, and also tried using the ExcludeIncludeFieldsList but without any luck.
Best regards
Andreas