📄 get.format
字号:
/// <summary>
/// Gets a {2} based on the criteria specified by QueryCriteria.And(..).
/// </summary>
/// <param name="relations">Specify which related tables should be fetched during this query</param>
/// <returns>A {0}, or null if not found</returns>
public {2} Get{0}(params OrmLib.DataManagerBase.FetchPathRelation[] relations)
{
System.Data.DataSet ds = OrmDataSet.NewDataSet();
FillDataSet( CreateSql("{1}", relations), ds, false);
System.Data.DataRow {0}Row = GetRow(ds, "{1}");
if ( {0}Row == null ) return null;
return new {2} (this, {0}Row);
}
/// <summary>
/// Gets a {2} from the already loaded records in this DataManager, by primary key.
/// </summary>
/// <remarks>
/// This method is made available for when the dataset has been serialized
/// from session state or disk.
/// </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}{5}"] = _{0}.{5};
///
/// /* second web page - need to get currend contact */
/// DataManager dm = new DataManager(Config.Dsn);
/// dm.DataSet = (DataSet)Session["DataSet"];
/// _{0} = dm.GetContactFromDataSet(({3})Session["{0}{5}"]);
/// </code>
/// </example>
/// <param name="{5}">Primary key of the data row to retrieve.</param>
/// <returns>A {0}, or null if not found</returns>
public {2} Get{0}FromDataSet({3} {5})
{
System.Data.DataRow {0}Row = null;
foreach(System.Data.DataRow dr in DataSet.Tables["{1}"].Rows)
{
if ( (({3})dr["{4}"]).ToString() == {5}.ToString() )
{
{0}Row = dr;
break;
}
}
if ( {0}Row == null) return null;
return new {2} (this, {0}Row);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -