我有一个 LLBLGen 实体。
MyEntity{
public Decimal Foo; //Stored in database as a NOT NULL field
}
....
public void SomeMethod(){
MyEntity entity = new MyEntity(); //on initial inspection Foo reads as "0"
adapter.SaveEntity(entity); //will throw exception, "Foo can't be assigned a NULL value"
//but on debug inspection, Foo = 0
entity.Foo = 14M;
adapter.SaveEntity(entity); //will save ok.
}
如果我没有为数字赋值,调试器会将其读取为非空,但是,它会抛出一个异常,告诉我它实际上是 NULL。
我相信 LLBLgen 会自动为所有变量分配默认值,但我现在不能确定。
请任何能够对此有所了解的人。谢谢。