关于插入错误
本帖最后由 asm_shen 于 2013-09-05 13:37:00 编辑
            如果有两个类 
class A
{
     guid id;
     B b;
}
class B
{
     guid id;
     int a;
}
其中int a为非空;
如果我插入add(new A{B=null})的时候会报错,说int a不能为空。请问我应该怎么插入
              
------解决方案--------------------class A
{
    public Guid id { get; set; }
    public B b { get; set; }
}
add(new A() { b = default(B) });
------解决方案--------------------class B
{
    public Guid id { get; set; }
    public int a { get; set; }
}