SubSonic 2.2支持延迟加载吗?我可以延迟加载一个对象的属性吗?如果是,我在哪里可以找到关于这方面的信息?
发布于 2010-03-12 16:27:34
Subsonic 2.2不支持延迟加载。
调用中加载并插入到列表中的所有数据。
怎么做都是个好主意。
这里是加载数据的点。
/// <summary>
/// Loads the collection and leaves the IDataReader open.
/// </summary>
/// <param name="dataReader">The data reader.</param>
public void Load(IDataReader dataReader)
{
while(dataReader.Read())
{
ItemType item = new ItemType();
item.Load(dataReader);
Add(item);
}
}
/// <summary>
/// Loads the collection by iterating through the rows in the supplied DataTable.
/// </summary>
/// <param name="dataTable">The data table.</param>
public void Load(DataTable dataTable)
{
foreach(DataRow dr in dataTable.Rows)
{
ItemType item = new ItemType();
item.Load(dr);
Add(item);
}
}https://stackoverflow.com/questions/2324393
复制相似问题