All Projects → structuremap → Structuremap.microsoft.dependencyinjection

structuremap / Structuremap.microsoft.dependencyinjection

Licence: mit
StructureMap integration for ASP.NET Core

Projects that are alternatives of or similar to Structuremap.microsoft.dependencyinjection

Run Aspnetcore Angular retired
Enterprise Web Application infrastructure for ASP.NET Core and Angular. Boilerplate for ASP.NET Core + Angular reference application, demonstrating a layered application architecture with DDD best practices. Download 100+ page eBook PDF from here ->
Stars: ✭ 36 (-50%)
Mutual labels:  aspnetcore
Couchdb Net
EF Core-like CouchDB experience for .NET!
Stars: ✭ 50 (-30.56%)
Mutual labels:  aspnetcore
Identityserver4 Swagger Integration
How to get Swashbuckle or NSwag Swagger UI's working with IdentityServer 4
Stars: ✭ 60 (-16.67%)
Mutual labels:  aspnetcore
Aspnetcore Tests Sample
A project to help demonstrate how to do unit, integration and acceptance tests with an web api project using ASP.NET Core and Angular 7 front end.
Stars: ✭ 40 (-44.44%)
Mutual labels:  aspnetcore
Danvic.psu
This is my graduation project of dotnet core version
Stars: ✭ 46 (-36.11%)
Mutual labels:  aspnetcore
Proxykit
A toolkit to create code-first HTTP reverse proxies on ASP.NET Core
Stars: ✭ 1,063 (+1376.39%)
Mutual labels:  aspnetcore
Aspnetcore Vue
Sample setup on using asp.net core 2.1 + vue cli 3 in one project. This sample is deprecated and rolled into https://github.com/soukoku/AspNetCore.SpaServices.VueCli
Stars: ✭ 31 (-56.94%)
Mutual labels:  aspnetcore
Sejil
Capture, view and filter your ASP.net core log events right from your app
Stars: ✭ 70 (-2.78%)
Mutual labels:  aspnetcore
Easycaching
💥 EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
Stars: ✭ 1,047 (+1354.17%)
Mutual labels:  aspnetcore
Seq Extensions Logging
Add centralized log collection to ASP.NET Core apps with one line of code.
Stars: ✭ 57 (-20.83%)
Mutual labels:  aspnetcore
Znetcs.aspnetcore.authentication.basic
A simple basic authentication middleware.
Stars: ✭ 40 (-44.44%)
Mutual labels:  aspnetcore
Buildingblocks
Building blocks for Aspnet Core Microservices Development
Stars: ✭ 43 (-40.28%)
Mutual labels:  aspnetcore
Blazorcomponents
Simple reusable Blazor component library
Stars: ✭ 53 (-26.39%)
Mutual labels:  aspnetcore
Saunter
Saunter is a code-first AsyncAPI documentation generator for dotnet.
Stars: ✭ 39 (-45.83%)
Mutual labels:  aspnetcore
Aspnetboilerplate Core Ng
Tutorial for ASP.NET Boilerplate Core + Angular
Stars: ✭ 61 (-15.28%)
Mutual labels:  aspnetcore
Server
The core infrastructure backend (API, database, Docker, etc).
Stars: ✭ 8,797 (+12118.06%)
Mutual labels:  aspnetcore
Aspnetcore Request Decompression
HTTP request decompression middleware for ASP.NET Core
Stars: ✭ 51 (-29.17%)
Mutual labels:  aspnetcore
Cqrswithmediatr
CQRS implementation in .NET Core with MediaTR tutorial
Stars: ✭ 71 (-1.39%)
Mutual labels:  aspnetcore
Aspnetcore.identity.documentdb
A Cosmos DB / DocumentDB Storage Provider for ASP.NET Core Identity
Stars: ✭ 64 (-11.11%)
Mutual labels:  aspnetcore
Vuejs Aspnetcore Ssr
🆙 VueJS 2.5 Server Side Rendering on ASP.NET Core 2 and more
Stars: ✭ 57 (-20.83%)
Mutual labels:  aspnetcore

⚠️ As StructureMap has been sunsetted, it's recommended to move to Lamar, StructureMap's successor, which is more compatible with ASP.NET Core's DI system. ⚠️

StructureMap integration for ASP.NET Core Build status

This repository contains the source of two NuGet packages:

  • StructureMap.AspNetCore
  • StructureMap.Microsoft.DependencyInjection (formerly known as StructureMap.Dnx)

These packages provide integration with ASP.NET Core and the built-in container on different levels.

StructureMap.AspNetCore

Adds integration with the ASP.NET Core hosting mechanism.

Installation

Add StructureMap.AspNetCore to your project:

<ItemGroup>
  <PackageReference Include="StructureMap.AspNetCore" Version"<version>" />
</ItemGroup>

Usage

The package adds the UseStructureMap extension method to IWebHostBuilder. Calling this method will instruct the ASP.NET Core host to create a StructureMap Registry and optionally let the user configure it using a Startup.ConfigureContainer(Registry) method.

Example

using System.IO;
using Microsoft.AspNetCore.Hosting;
using StructureMap.AspNetCore;

public static class Program
{
    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseStructureMap() // Add support for StructureMap
            .UseStartup<Startup>();
}

The runtime will then look for a ConfigureContainer method on the specified Startup class:

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // Configure the ASP.NET specific stuff.
    }

    public void ConfigureContainer(Registry registry)
    {
        // Use StructureMap-specific APIs to register services in the registry.
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
    }
}

StructureMap.Microsoft.DependencyInjection

Adds StructureMap support for Microsoft.Extensions.DependencyInjection

Installation

Add StructureMap.Microsoft.DependencyInjection to your project:

<ItemGroup>
  <PackageReference Include="StructureMap.Microsoft.DependencyInjection" Version"<version>" />
</ItemGroup>

Usage

The package contains a single, public extension method, Populate. It's used to populate a StructureMap container using a set of ServiceDescriptors or an IServiceCollection.

Example

using System;
using Microsoft.Extensions.DependencyInjection;
using StructureMap;

public class Startup
{
    public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        services.AddWhatever();

        var container = new Container();
        
        // You can populate the container instance in one of two ways:
        
        // 1. Use StructureMap's `Configure` method and call
        //    `Populate` on the `ConfigurationExpression`.
        
        container.Configure(config =>
        {
            // Register stuff in container, using the StructureMap APIs...

            config.Populate(services);
        });
        
        // 2. Call `Populate` directly on the container instance.
        //    This will internally do a call to `Configure`.
        
        // Register stuff in container, using the StructureMap APIs...

        // Here we populate the container using the service collection.
        // This will register all services from the collection
        // into the container with the appropriate lifetime.
        container.Populate(services);

        // Finally, make sure we return an IServiceProvider. This makes
        // ASP.NET use the StructureMap container to resolve its services.
        return container.GetInstance<IServiceProvider>();
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].