0

I am trying to convert a .NET Framework project to .NET Core. There is a method that contains this code:

var type = model.FindDeclaredType(typeof(T).FullName);
var source = model.FindEntityContainer("Container").FindEntitySet(nameof(T));
var context = new ODataQueryContext(model, typeof(T), null);

var request = new HttpRequestMessage(HttpMethod.Get, baseAddress + dataQueryString);
queryOptions = new ODataQueryOptions<T>(context, request);

I get the error that it cannot convert a HttpRequestMessage from type System.Net.Http.HttpRequestMessage to Microsoft.AspNetCore.Http.HttpRequest. Apparently HttpRequestMessage is deprecated in .NET Core, but I also can't find any information on how to create a HttpRequest. I'm using the Microsoft.AspNetCore.Odata nuget package v8.0.12. This is a client application, so I'm open to other ways of doing this if there are more simple options available.

Any help is much appreciated.

Tried different versions of the package. Tried the httpshim package. Tried installing the AspNetCore.Http package but then get errors about dependency versions. Tried a lot of googling but it always shows me non-.NET core code.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.