❔ How should mine Connection String looks like? (EntityFramework)

During learning Entity Framework , I have noticed that most of ppl have (localdb) in fornt of the connection name (https://www.youtube.com/watch?v=SryQxUeChMc&list=PLdo4fOcmZ0oX7uTkjYwvCJDG2qhcSzwZ6 I had been starting from this tutorial). I would like to know it before MIgration to be sure If something went good. So... "Data Source=(uwu)\sqlexpress01;Initial Catalog=DAGRASSO Integrated Security=True;" may capitalize or It is something wrong with database? Btw UWU is my PC name
...
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"");
}
...
...
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"");
}
...
dotnet
YouTube
Getting Started with Entity Framework Core [1 of 5] | Entity Framew...
Learn more ➡️ https://learn.microsoft.com/training/dotnet/ Entity Framework Core is an Object-Relational Mapper that simplifies working with relational databases using strongly-typed .NET objects. Please note: At 4:08, the narration should state "Since FirstName and LastName are non-nullable strings, EF Core knows that when it creates the tabl...
9 Replies
SwaggerLife
SwaggerLife12mo ago
I believe the reason for that is becuase they are using the inbuilt visual studio database. But I see that you have ssms. Here is the default connection string for ssms, I guess.
"Server=localhost\\SQLEXPRESS;Database=QuotifyrDB;Trusted_Connection=True;Encrypt=True;TrustServerCertificate=True";
"Server=localhost\\SQLEXPRESS;Database=QuotifyrDB;Trusted_Connection=True;Encrypt=True;TrustServerCertificate=True";
You need to modify it. By providing your own dbname and change the other properties if needed. Your Server name might be different than mine.
Sossenbinder
Sossenbinder12mo ago
Your connection string is entirely arbitrary, it might be something local or not, depending on the domain your server resides on It's not necessarily a pattern like "my connection string needs to start with XYZ"
Ματι㊎②⑦⓪⑨
I believie so. So how do I know If I didn't made a mistake , because after
Update-Database
Update-Database
I got Instance failure. May should I search in documentation?
SwaggerLife
SwaggerLife12mo ago
update-database --verbose
update-database --verbose
Will give you some details if I remember correctly.
Ματι㊎②⑦⓪⑨
There's a lot and only shows places where
SwaggerLife
SwaggerLife12mo ago
Well you will need to provide further details. It's going to be a bit hard to help you without those details. The problem might be because you haven't registered dbcontext in service collection.
Ματι㊎②⑦⓪⑨
You mean libraries and installed stuff?
Angius
Angius12mo ago
The actual error for example
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.