首页 > 解决方案 > 使用 BrightIdeasSoftware 的 ObjectListView 时,ObjectContext 实例已被释放

问题描述

尝试为列表添加过滤器。我有一个文本框和一个在文本框文本更改时执行此操作的事件:

        this.objectListView1.ModelFilter = TextMatchFilter.Contains(this.objectListView1, filterString.Text);

当我在文本框中键入一个字符时,我收到以下错误:

    System.ObjectDisposedException: 'The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.'

我正在使用实体框架来获取列表视图的数据。当带有列表视图的表单加载时,我使用一种方法填充我的数据。

是什么导致了错误?我该如何纠正?

标签: entity-framework-6objectlistview

解决方案


推荐阅读