Stardust.Interstellar.Rest.DependencyInjection 1.0.2

Use Microsoft.Extensions.DependencyInjection in asp.net mvc and webapi

Install-Package Stardust.Interstellar.Rest.DependencyInjection -Version 1.0.2
dotnet add package Stardust.Interstellar.Rest.DependencyInjection --version 1.0.2
<PackageReference Include="Stardust.Interstellar.Rest.DependencyInjection" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Stardust.Interstellar.Rest.DependencyInjection --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Stardust.Interstellar.Rest.DependencyInjection, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Stardust.Interstellar.Rest.DependencyInjection as a Cake Addin
#addin nuget:?package=Stardust.Interstellar.Rest.DependencyInjection&version=1.0.2

// Install Stardust.Interstellar.Rest.DependencyInjection as a Cake Tool
#tool nuget:?package=Stardust.Interstellar.Rest.DependencyInjection&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Usage

In Startup.cs

  public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.AddDependencyInjection<Services>(ControllerTypes.Both);//alternatively only mvc or webapi
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
        }
    }

Add a new Class 'Services' to your solution:

public class Services : ServicesConfiguration
    {
        protected override IServiceCollection Configure(IServiceCollection services)
        {
            services.AddInterstellarServices();//Add WebApi controller generation support. nuget: Install-Package Stardust.Interstellar.Rest.Service
            services.AddScoped(s => s.CreateRestClient<IDummyService>("https://localhost:44357/"));//register a rest api client
            services.AddAsController<IDummyService, DummyService>(services.BuildServiceProvider());//Create and bind WebApi controller
            services.FinalizeRegistration();//Finalize controller registration
			//Add additional service bindings
            return services;
        }
    }

Usage

In Startup.cs

  public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.AddDependencyInjection<Services>(ControllerTypes.Both);//alternatively only mvc or webapi
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
        }
    }

Add a new Class 'Services' to your solution:

public class Services : ServicesConfiguration
    {
        protected override IServiceCollection Configure(IServiceCollection services)
        {
            services.AddInterstellarServices();//Add WebApi controller generation support. nuget: Install-Package Stardust.Interstellar.Rest.Service
            services.AddScoped(s => s.CreateRestClient<IDummyService>("https://localhost:44357/"));//register a rest api client
            services.AddAsController<IDummyService, DummyService>(services.BuildServiceProvider());//Create and bind WebApi controller
            services.FinalizeRegistration();//Finalize controller registration
			//Add additional service bindings
            return services;
        }
    }

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Stardust.Interstellar.Rest.DependencyInjection:

Package Downloads
Veracity.Common.OAuth.AspNet
Authentication library for the veracity services sdk for asp.net mvc5

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.2 1,794 9/21/2018
1.0.0 378 9/18/2018