【发布时间】:2021-11-22 10:42:45
【问题描述】:
我是开发 Dot Net 项目的新手,我大部分时间都在使用 React、Next.js 和 Vue.js 以及用于数据库的 Supabase 开发小型项目。
在ConfigureServices方法中,我看到教程使用options => options.UseSqlServer:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddControllersWithViews().AddRazorRuntimeCompilation();
}
除了使用 Supabase 之外,做同样事情的正确方法是什么?
我下载了nuget包https://www.nuget.org/packages/supabase-csharp/
但我没有看到任何关于如何在 ConfigureServices 方法中使用它的文档。
谢谢大家的建议!
【问题讨论】:
-
使用正确的 EF Core 提供程序。它甚至有一个吗?您链接到的包使用而不是 EF Core。如果您使用 PostgreSQL,则可以使用 NpgSQL EF Core 提供程序。由于 Supbase 实际上是一个托管服务,因此您不能使用它。
标签: c# asp.net-core asp.net-core-mvc supabase supabase-database