skip to Main Content

How import WebApplicationBuilder in a Class Library? – Asp.net

I want to create an extension method for WebApplicationBuilder: public static void AddData(this WebApplicationBuilder builder) { var connectionString = builder.Configuration.GetConnectionString("DefaultConnection"); builder.Services.AddDbContext<ApplicationDbContext>(option => { option.UseSqlite(connectionString); }); } this method works in a project that use: <Project Sdk="Microsoft.NET.Sdk.Web">, but if I put…

VIEW QUESTION
Back To Top
Search