entity-framework-6 - using 语句中使用的类型必须可显式转换为“System.IDisposable”
问题描述
在现有数据库上使用 Entity Framework 和 Devart Entity Developer。我使用向导将所需的表带入实体设计器模型。保存模型 - 为 EF 创建底层代码。现在当我尝试使用:
using (Document ctx = new Document())
{
}
我得到错误:
CS1674 'Document':在 using 语句中使用的类型必须隐式转换为 'System.IDisposable' 或实现合适的 'Dispose' 方法。
我已经看到建议该状态以确保将实体框架添加为 NuGet 包的帖子 - 确实如此。我以前在这种情况下使用过实体设计器,但没有遇到这个问题。
有任何想法吗?
编辑
文档:
public partial class Document : EntityObject {//...
实体对象:
namespace System.Data.Entity.Core.Objects.DataClasses
{
/// <summary>
/// This is the class is the basis for all perscribed EntityObject classes.
/// </summary>
[DataContract(IsReference = true)]
[Serializable]
public abstract class EntityObject : StructuralObject, IEntityWithKey, IEntityWithChangeTracker, IEntityWithRelationships
{
解决方案
推荐阅读
- google-cloud-run - Cloud Run 是否添加类似于 App 引擎的位置感知请求标头?
- python-3.x - ModuleNotFoundError: No module named 'bokeh' 许多已发布的解决方案尝试但失败了
- sql - 此处不允许列,
- r - 有没有办法使用另一个具有原始和新列名的表来重命名 r 中数据框的列?
- android - url.pathname 或 url.searchParams 不是 android react native 中的函数
- c - clang 致命错误:致命错误:找不到“stdint.h”文件
- react-native - 如何将自定义组件添加到抽屉导航
- python - 如何用python语言为nifi创建插件
- c# - FromSqlRaw 返回值
- php - 搜索最小值时从关联数组返回 array_column