所以我刚刚安装了Windows 10和Visual Studio 2017社区的干净版本.
尝试创建一个全新的ASP.NET Core 2.0项目,我看到节点Bower下缺少这个项目Dependencies.
Bootstrap和jquery软件包已经安装,但我无法管理它们,似乎也找不到配置文件.
我在网上搜索了这个问题,但没有发现任何有用的东西.
VS 15.5.2更新有问题吗?我怎样才能解决这个问题?
我有一个ASP.NET Core(完整.NET Framework)应用程序,具有以下配置:
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>(p => {
p.Password.RequireDigit = true;
p.Password.RequireNonAlphanumeric = false;
p.Password.RequireUppercase = true;
p.Password.RequiredLength = 5;
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
// Add application services.
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
services.AddTransient<IDbFactory, DbFactory>();
services.AddTransient<IUnitOfWork, UnitOfWork>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<IUserService, UserService>();
}
Run Code Online (Sandbox Code Playgroud)
ApplicationUser从IdentityUser扩展而ApplicationDbContext扩展了IdentityDbContext
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base()
{
}
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public virtual void Commit()
{
base.SaveChanges();
} …Run Code Online (Sandbox Code Playgroud) 使用[Authorize]属性时如何在 ASP.NET Core 上显示错误页面?
政策
services.AddAuthorization(p =>
{
p.AddPolicy("RequireAdminRole", policy => policy.RequireRole("Admin"));
p.AddPolicy("RequireTrainerRole", policy => policy.RequireRole("Trainer"));
p.AddPolicy("RequireTeamLeaderRole", policy => policy.RequireRole("Team Leader"));
p.AddPolicy("RequireUserRole", policy => policy.RequireRole("User"));
});
Run Code Online (Sandbox Code Playgroud)
控制器
[Authorize(Policy = "RequireAdminRole")]
[Area("Admin")]
public class BaseController : Controller
{
}
Run Code Online (Sandbox Code Playgroud) 我知道这是以前问过的那种问题,但我找不到有效的答案。
因此,是否有可能更改迁移的存储位置?我正在使用EF Core。
仅供参考:我知道,如果您移动第一个生成的迁移,则即将迁移的迁移将放置在同一位置。