]; } }
if ( id!=null ) { IdentifierType.NullSafeSet( st, id, index, session ); index += IdentifierColumnNames.Length; }
return index; }Dehydrate遍历持久对象的属性,并调用属性类型(IType接口)的NullSafeSet方法对IDbCommand对象中的参数进行赋值,PropertyTypes在AbstractEntityPersister类中定义,为所有属性类型的集合。
//*** NullableType.cs ***
public void NullSafeSet(IDbCommand cmd, object value, int index) { if (value==null) { ( (IDataParameter)cmd.Parameters[index] ).Value = DBNull.Value; } else { Set(cmd, value, index); } }如为null,则设置参数值为DBNull.Value;否则调用Set方法,Set方法为virtual方法。
(待续...)
上一页 [1] [2] |