skip to Main Content

asp.net 6 EF using MySql Database not working

I am trying to connect my Web API build in asp.net 6 with MySql and I am having a lot of trouble My Service looks like this builder.Services.AddDbContext<TicketApiContext>(options => options.UseMySQL("CONNECTION_STRING")); and my Database Context like this. using Microsoft.EntityFrameworkCore; namespace VelocityNetAPI.Data…

VIEW QUESTION

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