gpt4 book ai didi

c# - 找不到命名空间名称 'Display' 和 'DisplayAttribute'

转载 作者:太空宇宙 更新时间:2023-11-03 12:50:29 25 4
gpt4 key购买 nike

在尝试编译我的 .Dll 时,我设法找出了所有引用资料和错误,除了这两个(我有多个)。

"The type or namespace name 'Display' could not be found(are you missing a using directive or an assembly reference?)"

"The type or namespace name 'DisplayAttribute' could not be found(are you missing a using directive or an assembly reference?)"

我正在使用 System.ComponentModel 和 System.ComponentModel.DataAnnotations。请原谅我,因为我对所有这些都很模糊,我只是对这个项目做了一个小改动。我不明白我缺少什么引用导致这些错误,我也确定问题是由我的经验不足引起的。感谢任何帮助,谢谢。

一小部分代码:

using PatientTracker.Entities.Validation;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace PatientTracker.Entities
{
[Serializable]
public abstract class EntityBaseCore : IEntity, INotifyPropertyChanged, IDataErrorInfo, IDeserializationCallback, INotifyPropertyChanging
{
[Display(AutoGenerateField = false)]
[NonSerialized]
protected bool bindingIsNew = true;
[Display(AutoGenerateField = false)]
[NonSerialized]
private bool isEntityTracked;
[Display(AutoGenerateField = false)]
[NonSerialized]
private bool suppressEntityEvents;
private string entityHashCode;
[NonSerialized]
private object tag;
[NonSerialized]
private ValidationRules _validationRules;

[Display(AutoGenerateField = false)]
public abstract string TableName { get; }

[Display(AutoGenerateField = false)]
public abstract string[] TableColumns { get; }

[Browsable(false)]
[Display(AutoGenerateField = false)]
public virtual bool IsDeleted
{
get
{
return this.EntityState == EntityState.Deleted;
}
}

最佳答案

我右键单击显示并使用上面给出的程序集名称进行解析,它工作正常。删除和添加程序集没有。

关于c# - 找不到命名空间名称 'Display' 和 'DisplayAttribute',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35732573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com