You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何正确返回结果以便在EpiServer视图中访问UserStore变量

EpiServer Report Center 自定义用户报表构建问题

需求背景

尝试在EpiServer Report Center中构建自定义报表,用于展示所有用户的表格数据,已创建ViewModel尝试填充名为UserStore的变量。

相关代码

ViewModel 代码

using EPiServer.Cms.UI.AspNetIdentity;
using Microsoft.AspNet.Identity.EntityFramework;

namespace WebProject.Site.Models.ViewModels
{
    public class UsersReportViewModel
    {
        UserStore<ApplicationUser> userStore = new UserStore<ApplicationUser>(new IdentityDbContext("EPiServerDB"));

        return userStore;
    }
}

视图代码

@model UsersReportViewModel


@{ 
    Layout = null;

}

<div class="users-table">@Model.userStore;</div>

遇到的报错

  • ViewModel中return userStore位置报错:The name userStore does not exist in the current context
  • 视图侧报错:UsersReportViewModel.userStore is inaccessible due to its protection level

注:提问者后续已调整实现思路,该问题不再需要解答。

内容的提问来源于stack exchange,提问作者BrokenCode

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 12:09:03