在 ASP.NET Core Razor 页面上,我们可以执行以下操作来更改默认的基于文件夹的路由:
@page "/xxx/yyy"
Run Code Online (Sandbox Code Playgroud)
但尝试在某些类中使用强类型属性来执行此操作Constants.Routes
是行不通的
public const string Myroute = "/mysuperroute";
Run Code Online (Sandbox Code Playgroud)
和
@page @Constants.Routes.Myroute
Run Code Online (Sandbox Code Playgroud)
我在编译时遇到错误The 'page' directive expects a string surrounded by double quotes.
有没有解决的办法?我想避免通过选项重复路由,例如https://learn.microsoft.com/en-us/aspnet/core/razor-pages/razor-pages-conventions?view=aspnetcore-2.2#configure-a-page -路线 谢谢
在我的例子中,Documentdb 中的设置MaxItemCount = null
返回 100 个项目,但这背后的确切机制或逻辑是什么?进一步评论它与MaxItemCount = -1
大量文档的比较也会有所帮助。
通过在别处阅读的建议,角色是声明的子集,我正在寻找一种干净的方法来要求 ASP.NET Identity 中的 EF Core 实现不要在 VS 中的 ASP.NET Identity Core 2.0 模板中创建与角色相关的表2017. 只需要索赔。该模板使用
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
// Customize the ASP.NET Identity model and override the defaults if needed.
// For example, you can rename the ASP.NET Identity table names and more.
// Add your customizations after calling base.OnModelCreating(builder);
}
}
Run Code Online (Sandbox Code Playgroud)
而 IdentityDbContext 创建了这些 Roles 相关的表
如何在不操作迁移文件的情况下摆脱它们?