时间:2021-07-01 10:21:17 帮助过:18人阅读
3. 在Startup.cs的ConfigureServices方法中添加服务
- <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span><span style="color: #000000;"> ConfigureServices(IServiceCollection services)
- {
- <span style="color: #ff0000;">services.AddDbContext</span></span><span style="color: #ff0000;"><ApplicationDbContext>(options => options.UseSqlite($Configuration.GetConnectionString("sqliteConnection")</span><span style="color: #000000;"><span style="color: #ff0000;">));</span>
- services.AddDefaultIdentity</span><IdentityUser>().AddEntityFrameworkStores<ApplicationDbContext><span style="color: #000000;">();
- services.AddRazorPages();
- services.AddServerSideBlazor();
- services.AddScoped</span><AuthenticationStateProvider, RevalidatingAuthenticationStateProvider<IdentityUser>><span style="color: #000000;">();
- services.AddSingleton</span><WeatherForecastService><span style="color: #000000;">();
- }</span>
4.复制一个空的sqlite数据库文件到项目里,设置较新时复制,生成操作无生成一下项目
5.迁移代码,用包管理器的命令行初始化数据库
- Add-<span style="color: #000000;">Migration Init<br></span>
7.作者暂时重启一下电脑
sqlite + .net core ef 3
标签:ext public 认证 管理 ide 包管理器 getc tar cti