编辑:我已将成功的解决方法添加到此答案的底部。
这很奇怪......但是,如果我将“Access”属性设置为'Public' 以外的任何东西,“set”就会消失:
使用“Access=Public”和“ReadOnly=True”:
public bool IsLatest
{
get
{
return this._IsLatest;
}
set
{
if ((this._IsLatest != value))
{
this.OnIsLatestChanging(value);
this.SendPropertyChanging();
this._IsLatest = value;
this.SendPropertyChanged("IsLatest");
this.OnIsLatestChanged();
}
}
}
使用“Access=Protected”和“ReadOnly=True”:
protected bool IsLatest
{
get
{
return this._IsLatest;
}
}
我不知道为什么存在这个错误(至少对我来说?),但如果我让它工作(公共和只读),我会更新这个答案。
编辑:这是可悲的解决方法:
我已经从我的 DBML 文件中删除了该属性,并简单地添加了我自己的“部分”类并自己设置了列:
public partial class ServicerData
{
private bool _IsLatest = default(bool);
[Column(Storage = "_IsLatest", AutoSync = AutoSync.Always, DbType = "Bit NOT NULL", IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
public bool IsLatest
{
get
{
return this._IsLatest;
}
}
}
这不是我想做的,但似乎没有别的办法。