C
C#

help

✅ Build failed on `dotnet-ef database update`

Ddemndev2/20/2023
FFusedQyou2/20/2023
Did you build and try the command afterwards? Can we see the code up to the point where you call AddDbContext?
Ddemndev2/20/2023
yes:
public static IServiceCollection AddPersistence(this IServiceCollection services, IConfiguration configuration)
{
var connection = configuration.GetConnectionString("DefaultConnection")
?? throw new Exception("Unable to parse DbConnection configuration");
services.AddDbContext<IApplicationContext, ApplicationContext>(options => options.UseSqlite(connection));


return services;
}
public static IServiceCollection AddPersistence(this IServiceCollection services, IConfiguration configuration)
{
var connection = configuration.GetConnectionString("DefaultConnection")
?? throw new Exception("Unable to parse DbConnection configuration");
services.AddDbContext<IApplicationContext, ApplicationContext>(options => options.UseSqlite(connection));


return services;
}
FFusedQyou2/20/2023
And up to where you call AddPersistence?
Ddemndev2/20/2023
var builder = WebApplication.CreateBuilder(args);
{
builder.Services
.AddApplication()
.AddPersistence(builder.Configuration)
.AddWeb(builder.Configuration);
}
var builder = WebApplication.CreateBuilder(args);
{
builder.Services
.AddApplication()
.AddPersistence(builder.Configuration)
.AddWeb(builder.Configuration);
}
FFusedQyou2/20/2023
Maybe try removing {}
Ddemndev2/20/2023
no, but it builds when I call database update:
Build started...
Build started...
FFusedQyou2/20/2023
I believe EF injects code up to AddDbContext and it might not be able to properly do that
Ddemndev2/20/2023
all the same
Ddemndev2/20/2023
and again there's nothing helpful
Ddemndev2/20/2023
miraculously the problem solved itself

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
❔ How can I get Rider to debug an Office add-in?I'm trying to get started debugging Office add-in with Rider. I have found guides all over without bProcessing of the HTTP request resulted in an exception. Please see the HTTP response returned by...Hello, I am working on an API in MVC and I want throw an exception, but I get the following error: `❔ windows service socket errorsocket accept works successfully in IDE, but not in win service.Coding a game of CrapsCurrently in the middle of coding it however I have ran into some errors making this a bit difficult❔ how do i make a first person game UNITYi want to lurn how to make a first person servival game using C# unity❔ C# Will not write to txt fileNot to sure what I did wrong as this is the first time I'm trying this. The code runs just gives (pr❔ Having MSSQL Cert Issues In a ASP.NET ProjectAnyone have any idea on how I can solve this issue? It's only a problem with my new .net 6 project e✅ dotnet new react - with mvc?I want to learn and use React. How do I create an app that uses both react and mvc using cli? I can How do I call the constructor of a parent class?If I have something like ```cs abstract class parent { public parent(string mom, string dad) {...}❔ Hi i need help with error SeverityCodeDescriptionProjectFileLineSuppression StateErrorCS1501Here the codeMake a new type that essentially acts like anotherIn my project, I've found that Im making a lot of structs/classes that are essentially containers f❔ Error with NaudioI only can play the audio once and then no sound is played✅ this extractor writes the project name + the file name how do I make it just say the file nameThis extractor ~~which I got from stackoverflow because I dont know how to code in c# that much~~ wh✅ RestSharp not using given ProxyHey all! I know this is quite off topic from regular C# as this post is bound to a NuGet Package but❔ Access Resources FileHey, sorry to bother - quick question. I created a EmailResources.resx file inside a "Resources" fol❔ Do Transparent All White Pixcelprivate void button3_Click(object sender, EventArgs e) { // Bir resim seçme işle❔ Error Result ViewHi, I don't know why this error is occurring, does anyone know what I can do to fix it?❔ Cassandra: which programming language have the best support for accessing and write data?Hi my application need to scale the data source, we heard about Cassandra and really want to use it,❔ C# Need help with changing SQL connection stringI got a program which has database in it but I can't run it properly as I don't know how to change t✅ Operator ?? functionsI came across ?? operators whilst I try to understand solutions like https://leetcode.com/problems/n