Linked Questions
16 questions linked to/from How to auto create database on first run?
0
votes
1
answer
210
views
Entity Framework Core code-first approach: database not being created automatically [duplicate]
I'm having an issue with Entity Framework Core while trying to use the code-first approach.
I want the database to be automatically created when I run the code, but it's not happening.
If I don't ...
19
votes
3
answers
33k
views
Create Tables on runtime in EF Core
I know I can use the following command to add a new migration and create the database :
dotnet ef migrations add MigrationName -c DbContextName
dotnet ef database update -c DbContextName
but I need ...
2
votes
2
answers
11k
views
EF code first not creating the database
Here is my code:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<AppDbContext>(options =>
{
options.UseSqlServer(Configuration....
user avatar
user7066088
3
votes
1
answer
8k
views
Auto Create database using EF Core
I'm using EF Core in my Winforms application but I can't generate database automatically without migrations.
I read this articles but It is for asp.net core: auto create database in Entity Framework ...
2
votes
1
answer
4k
views
DbUpdateException error trying to use EF core code first
I have a simple Web API and I am trying to use entity framework core code first, with an external sql server database hosted on AWS RDS. My aim is for EF to create my model database/tables ...
0
votes
1
answer
1k
views
ASP.NET MVC - 'no such table': AspNetUsers
I'm creating a web app that will allow users to log in to execute certain actions. I followed this tutorial (for simplicity, you can search for "Generate the database to store membership data" for the ...
0
votes
1
answer
2k
views
C# - Entity Framework Core - auto create database
I want to automatically create the database and table structures when my desktop app is first run.
I can't find any examples or documentation on something equivalent for EFCore.
I did everything as ...
3
votes
2
answers
649
views
Visual studio app.config file database path for installed apps
I am using local database in my app and when I generate installation file (By Installer Package), after installing program it gives database path errors.
Eample
an attempt to attach an auto-named ...
1
vote
0
answers
1k
views
Entityframework : DropCreateDatabaseAlways, where and how?
I am working with Entityframework Code-First and trying to get my tables to drop and then recreate at every startup. However Database.SetInitializer is not recognized and intellisense is not giving me ...
0
votes
1
answer
1k
views
Deployed .NET Core Application with database migrations packed in the folder won't make a new database on a server. How can I force this?
So I have a ton of migration files like this that work and apply their changes when I start the application locally no problem whatsoever.
I also have defined my connection strings and database name ...
0
votes
1
answer
918
views
ASP.NET Core 6 Web API : update database command on deployment
I am new to ASP.NET Core and using Entity Framework 6.
I have created a Web API using MySql. On development, I have executed add migrations and update-database command.
Now, I have published the Web ...
0
votes
1
answer
970
views
How to fix table does not exist Entity Framework Core with SQLite 7.0 code-first
Exception in EF Core 7 / SQLite with a code-first approach :
Table does not exist
Code is here with issue detail:
https://github.com/HumairaSid/EFCoreBasicCaching
I'm trying to create a SQLite ...
1
vote
1
answer
445
views
EF Core - create database programmatically
What's the best approach to create a database in EF core programmatically and then run the migrations to make sure the new database has all database objects?
We're building a SaaS based application ...
0
votes
0
answers
403
views
Why AppDbContext constructor is not invoked?
I am writing an api using aspnet identity, on configuring services I use .AddDbContext methdos but nothing happens. The construcotr of AppDBContext is not invoked. I set a breakpoint in AppDBContext ...
0
votes
0
answers
321
views
SqlException: Cannot open database X requested by the login. The login failed. Login failed for user Y
I have searched high and low for a fix for this and cannot find one that works in my case. I've setup a new project using Razor Pages with no authentication.
Made a change to a model, so added a ...