我正在尝试使用接口实现我的持久类。我创建了以下
public interface IFoo
{
int Id {get;set;}
}
public class Foo : IFoo
{
private int _id;
public int Id {get{return _id;} set{_id = value;}}
}
public interface IBar
{
int Id {get;set;}
IFoo Foo {get;set;}
}
public class Bar : IBar
{
private int _id;
private IFoo _foo;
public int Id {get{return _id;} set{_id = value;}}
public IFoo Foo {get{return _foo;} set{_foo = value;}}
}
是否可以表明 Foo 是一个有效的类并默认使用它,我不想使用数据库来存储类类型。
谢谢
罗汉