小编Oct*_*pus的帖子

Razor Pages 中 @page 指令中的强类型路由

在 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 -路线 谢谢

asp.net-core razor-pages

15
推荐指数
1
解决办法
2994
查看次数

CosmosDb 中 MaxItemCount = null 与 MaxItemCount= -1 的含义

在我的例子中,Documentdb 中的设置MaxItemCount = null返回 100 个项目,但这背后的确切机制或逻辑是什么?进一步评论它与MaxItemCount = -1大量文档的比较也会有所帮助。

azure-cosmosdb

7
推荐指数
1
解决办法
2357
查看次数

如何从 ASP.NET Identity Core 2.0 中删除与角色相关的表

通过在别处阅读的建议,角色是声明的子集,我正在寻找一种干净的方法来要求 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 相关的表

https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/IdentityDbContext.cs

如何在不操作迁移文件的情况下摆脱它们?

asp.net-identity asp.net-core-2.0 ef-core-2.0

3
推荐指数
1
解决办法
2272
查看次数