Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Plugging a Third-Party IoC Container (e.g. AutoFac) into .NET Core 6

var builder = WebApplication.CreateBuilder(args);

// The UseServiceProviderFactory call attaches the
// Autofac provider to the generic hosting mechanism.

builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());

// Add services to the container.
builder.Services.AddControllersWithViews();

//Register your own things directly with Autofac here
builder.Host.ConfigureContainer<ContainerBuilder>(builder => builder.RegisterType<Service>().As<IService>());

var app = builder.Build();
Comment

PREVIOUS NEXT
Code Example
Csharp :: autfac .net 6 
Csharp :: how to create function in c# 
Csharp :: c# yield 
Csharp :: pyqt minimize to tray icon 
Csharp :: linked list revrse 
Csharp :: asp .net core 3 mvc select with default value 
Csharp :: how read excel data in c# 
Csharp :: C# extract all of a property from a list of objcets 
Csharp :: c# draw rectangle on screen 
Csharp :: if list does not contain then add c# 
Csharp :: c# list item not in another list 
Csharp :: deploy .net core 
Csharp :: remove item from list in for loop c# 
Csharp :: list sort c# 
Csharp :: c# max function 
Csharp :: convert c# string to int 
Csharp :: c# callback action lambda 
Csharp :: c# tuple 
Csharp :: c# optional arguments 
Csharp :: freeze scene unity 
Csharp :: c# convert date to oracle format 
Csharp :: c# callback param 
Csharp :: unity c# find object position in array 
Csharp :: predicate EF Core search query 
Csharp :: c# window form align right bottom 
Csharp :: automapper c# initialize error 
Csharp :: verifyusertokenasync password reset token 
Csharp :: c# remove xml invalid characters 
Csharp :: c# split quotation 
Csharp :: remove empty strings from list c# 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =