收到此错误:
Error 4 'ZoneUpdates.Models.PgeDataContext.PgeDataContext(string, System.Data.Linq.Mapping.MappingSource)' must declare a body because it is not marked abstract, extern, or partial C:\Code\ZoneUpdates\ZoneUpdates\Models\PgeDataContext.cs 18 16 ZoneUpdates
Error 6 'ZoneUpdates.Models.ZoneObject.SendPropertyChanged(string)' must declare a body because it is not marked abstract, extern, or partial C:\Code\ZoneUpdates\ZoneUpdates\Models\PgeDataContext.cs 42 32 ZoneUpdates
这四个类之间基本上有13个错误(以下两个)。
我正在使用4.0,我基本上从另一个项目中复制并粘贴了这个代码,它按预期工作。我已经尝试将类更改为部分,但无济于事。任何指针都表示赞赏。
[Database(Name = "Pge_Dev")]
public class PgeDataContext : DataContext
{
public PgeDataContext(IDbConnection connection);
public PgeDataContext(string dsn);
public PgeDataContext(
IDbConnection connection,
System.Data.Linq.Mapping.MappingSource mappingSource);
public PgeDataContext(
string connection,
System.Data.Linq.Mapping.MappingSource mappingSource);
public Table<ZoneObject> ZoneObject { get; set; }
public Table<ZoneObjType> ZoneObjType { get; set; }
public Table<ZoneTypeBridge> ZoneTypeBridge { get; set; }
}
[Table(Name = "dbo.ZoneObject")]
public class ZoneObject : INotifyPropertyChanging, INotifyPropertyChanged
{
public ZoneObject();
[Column(Storage = "ID", DbType = "Int NOT NULL")]
public int ID { get; set; }
[Column(Storage = "Name", DbType = "nvarchar(30)")]
public int Name { get; set; }
[Column(Storage = "Value", DbType = "bigint")]
public int Value { get; set; }
[Column(Storage = "CancurrencyID", DbType = "Int NOT NULL")]
public int ConcurrencyID { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public event PropertyChangingEventHandler PropertyChanging;
protected virtual void SendPropertyChanged(string propertyName);
protected virtual void SendPropertyChanging();
}
答案 0 :(得分:2)
错误示例
没有身体的构造者
public PgeDataContext(IDbConnection connection);
=&GT;你必须声明一个身体
public PgeDataContext(IDbConnection connection){ /*blibli*/ }
没有身体的方法
protected virtual void SendPropertyChanged(string propertyName);
=&GT;您必须为非抽象,外部或部分方法声明一个正文,如错误消息中所述
protected virtual void SendPropertyChanged(string propertyName) {
/*blabla*/
}