Odata V4 2017 in Aspnet Core 7 Querying Data

John Kimotho 0 Reputation points
2023-09-14T17:08:10.07+00:00

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;
          }
      }
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,145 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,208 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
293 questions
{count} votes