Odata V4 2017 in Aspnet Core 7 Querying Data
John Kimotho
0
Reputation points
Am getting this error when am querying data from Navision 2017 Odata V4 webservices to Aspnet core 7.Is it a compatiblity issue because it works on odata v4 for business central?When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataResourceWriter method or the ODataResourceSerializationInfo must be set on the ODataResource or ODataResourceSet that is being written.It occurs on this function
public T Get<T>(Expression<Func<T, bool>> func) where T : class
{
try
{
var entity = nav.CreateQuery<T>(typeof(T).Name).AsQueryable().Where(func);
var filterQuery = ((DataServiceQuery)entity).RequestUri.Query.ToLower();
if (filterQuery.Contains("null"))
return null;
return entity.FirstOrDefault();
}
catch (Exception)
{
return null;
}
}
Sign in to answer