Basic structure & EF Core
Once we have completed the first steps we are ready to create our basic structure. We need to add Dtos, Models, Seed.Core => Infrastructure
it should look like this:

We can also add a Data
folder to work with EntityFrameworkCore
code first.
using Microsoft.EntityFrameworkCore;
namespace api_seed.Data
{
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
}
}
In our ConfigureServices
we need to add the following lines to connect with our DataContext
class:
// Instantiate the DataContext
services.AddDbContext<DataContext>
(x => x.UseMySql(Configuration.GetConnectionString("DefaultConnection")));

Last updated
Was this helpful?