getcollection.format

来自「客户关系管理系统ASP.NET+VB.NET编程完整程序!」· FORMAT 代码 · 共 69 行

FORMAT
69
字号

		/// <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 + =
减小字号Ctrl + -
显示快捷键?