OData / Extensions

ExtensionsLib: - Extensions for OData libraries and framework
MIT License
11 stars 19 forks source link

Use extensions from a Non Asp.net Core context #22

Open pietje666 opened 4 years ago

pietje666 commented 4 years ago

How should we use this package from a Non ASP.net Core context where the Ninject DI system is being used? Hence i can not use the provided AddODataClient() / AddHttpClient() functionality since it is build on IServiceprovider which is not available.

Binding the DefaultODataClientFactorymanually is not possible neither since the class is marked as internal (and deriviates as well). I am also wondering how i could get it working.

weitzhandler commented 4 years ago

Usually there are bridges between the various IoC providers. Never used Ninject, but you should be able to find an adapter that gives you a Microsoft.Extensions.DependencyInjection.IServiceCollection and IServiceProvider respectively, wrapped around your Ninject service provider, that you can use with OData Extensions.

And BTW, Microsoft Extensions has vastly improved lately and provides all the plumbing around any of your .NET Core apps - not just ASP.NET, also console or WPF apps, and it also includes logging and bootstrapping, so if you're building a new project and don't have a special reason to use Ninject, you might consider giving it a shot.