📄 getcollection.format
字号:
/// <summary>
/// Gets multiple {0}s based on the criteria specified by QueryCriteria.And(..).
/// </summary>
/// <returns>A collection of {0} objects</returns>
public {2}Collection Get{0}Collection()
{
return Get{0}Collection(FetchPath.{0});
}
/// <summary>
/// Gets multiple {0}s based on the criteria specified by AddCriteria(..).
/// </summary>
/// <param name="relations">Specify which related tables should be fetched during this query</param>
/// <returns>A collection of {0} objects</returns>
public {2}Collection Get{0}Collection(params OrmLib.DataManagerBase.FetchPathRelation[] relations)
{
System.Data.DataSet ds = OrmDataSet.NewDataSet();
FillDataSet(CreateSql("{1}", relations), ds, false);
System.Data.DataRow[] {0}List = GetRows(ds,"{1}");
if ( {0}List == null ) return null;
{2}Collection a = new {2}Collection();
foreach ( System.Data.DataRow dr in {0}List )
a.Add(new {2}( this, dr ));
// must be added afterwards
a.DataManager = this;
return a;
}
/// <summary>
/// Gets a collection of {0} from the already loaded records in this DataManager instance.
/// </summary>
/// <remarks>
/// This method is made available for when the dataset has been serialized
/// from session state or disk. This method will return all {0} loaded.
/// </remarks>
/// <example>
/// This example shows a reason to use this method.
/// <code>
/// /* first web page - save dataset and primary keys */
/// Session["DataSet"] = dm.DataSet;
/// Session["{0}ID"] = _{0}.ID;
///
/// /* second web page - need to get current contact */
/// DataManager dm = new DataManager(Config.Dsn);
/// dm.DataSet = (DataSet)Session["DataSet"];
/// _{0} = dm.GetContactFromDataSet((int)Session["{0}ID"]);
/// </code>
/// </example>
/// <returns>A collection of {0} objects.</returns>
public {2}Collection Get{0}CollectionFromDataSet()
{
System.Data.DataRow[] {0}List = GetRows(DataSet, "{1}");
{2}Collection a = new {2}Collection();
foreach(System.Data.DataRow dr in {0}List )
a.Add( new {2}(this, dr));
// must be added afterwards
a.DataManager = this;
return a;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -