pauldotknopf / react-aspnet-boilerplate

A starting point for building isomorphic React applications with ASP.NET Core, leveraging existing techniques.
MIT License
287 stars 52 forks source link

The project should be database independent #33

Open kedare opened 7 years ago

kedare commented 7 years ago

Hello.

I wanted to test this generator for .NET core but apparently it's quite hard to use is without SQL Server, event after changing the connection string and adapting the Startup.cs, there are references of SQL Server specifics features in the migrations.

I think it could be interesting to make the boilerplate independent from any database.

Thanks

earthslasthope commented 7 years ago

Try the following:

yo react-aspnet-boilerplate:empty-template

That one does not use a database (or at least doesn't appear to).

mudrz commented 7 years ago

To use a different Entity Framework provider do the following: project.json

//"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Npgsql.EntityFrameworkCore.PostgreSQL": "1.1.0",

Startup.cs

// Add framework services.
// services.AddDbContext<ApplicationDbContext>(options =>
//      options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

services.AddDbContext<ApplicationDbContext>(options =>
        options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));

Migrations folder delete all files, then run in terminal/command prompt dotnet ef migrations add initial dotnet ef database update