Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无懒散加载的gridmvc查询_C# - Fatal编程技术网

C# 无懒散加载的gridmvc查询

C# 无懒散加载的gridmvc查询,c#,C#,آ以下是我的店铺等级: public class Store : IEntity, IAuditedEntity { public Store(); public double CommissionRate { get; set; } public bool CommissionEnabled { get; set; } public virtual ICollection<User> StoreUsers { get; set; }} 如果该存储的任何用

آ以下是我的店铺等级:

public class Store : IEntity, IAuditedEntity
{
    public Store();

    public double CommissionRate { get; set; }
    public bool CommissionEnabled { get; set; }
public virtual ICollection<User> StoreUsers { get; set; }}
如果该存储的任何用户具有
winappinstall=true
,我想在gridview列中显示“是”,下面是我的代码:

 cols.Add("CustomerAppInstalled").WithHeaderText("HAs App?")
                                .WithValueExpression(p => p.OnlinePaymentEnabled.ToBoolean() ? "yes" : "no")
                                .WithVisibility(visible: true, allowChangeVisibility: true)
                                .WithSorting(true);
但它抛出了以下例外:

objectcontext实例已被释放


我的解决方案是使用.Include禁用懒散加载,但我不知道在哪里?

如果要关闭代码中特定属性的懒散加载,请标记

public virtual ICollection<User> StoreUsers { get; set; }}

如果要关闭代码中特定属性的延迟加载,请标记

public virtual ICollection<User> StoreUsers { get; set; }}
public ICollection<User> StoreUsers { get; set; }}
this.Configuration.LazyLoadingEnabled = false;