This is a very broad and general question. Please advise.
I have tried starting an ASP.NET core project but have failed when it came to generating the database.
I could not get anything to work. I have lost my code while reinstalling studio.
Would some one be so kind to instruct and provide a working example of the context and startup classes(and etc)?
I would greatly appreciate if you would also provide an example of installing and working with the
Yes you can create the database using Entity Framework code first, just like previous versions of ASP.NET. It's a little different though, as you don't use Visual Studio, but rather you open up cmd.exe. Navigate to the project's src folder, then enter the following commands:
dotnet ef migrations add firstMig -c DbContextName
This will create a folder named migrations inside the project, along with an initial migration file and a 'firstMig' file (which is the name of the migration we are creating. These migrations will be used to update the database with the following command:
dotnet ef database update -c DbContextName
I have recently released a blog post, which is a tutorial that goes over step by step how to setup ASP.NET RC2 with Entity Framework code first on a PostgreSQL database. Hope this is helpful!