PageRenderTime 57ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/examples/EFTester/Acme.TestModel/Business/Objects/ChildCollection.Generated.cs

#
C# | 1405 lines | 816 code | 142 blank | 447 comment | 93 complexity | fa5aaaaccb90b155881a693353bf8330 MD5 | raw file
Possible License(s): JSON, CC-BY-SA-3.0

Large files files are truncated, but you can click here to view the full file

  1. using System;
  2. using System.Data;
  3. using System.Xml;
  4. using System.Collections;
  5. using System.Runtime.Serialization;
  6. using System.ComponentModel;
  7. using Acme.TestModel.Business.Rules;
  8. using Acme.TestModel.Business.SelectCommands;
  9. using Acme.TestModel.Domain.Objects;
  10. using Widgetsphere.Core.DataAccess;
  11. using Widgetsphere.Core.Util;
  12. using Widgetsphere.Core.Logging;
  13. using Widgetsphere.Core.Exceptions;
  14. using Acme.TestModel.Business.LINQ;
  15. using System.IO;
  16. using System.Collections.Generic;
  17. using System.Linq.Expressions;
  18. using System.Data.Linq;
  19. using System.Linq;
  20. using System.Text;
  21. using Widgetsphere.Core.EventArgs;
  22. using System.Text.RegularExpressions;
  23. namespace Acme.TestModel.Business.Objects
  24. {
  25. /// <summary>
  26. /// The collection to hold 'Child' entities
  27. /// aaaa
  28. /// </summary>
  29. [Serializable()]
  30. public partial class ChildCollection : Widgetsphere.Core.DataAccess.BusinessCollectionPersistableBase, Widgetsphere.Core.DataAccess.IPersistableBusinessCollection, System.IDisposable, System.ComponentModel.IListSource, System.Collections.IList, System.Collections.IEnumerator, System.Collections.Generic.IEnumerable<Acme.TestModel.Business.Objects.Child>, Widgetsphere.Core.DataAccess.IWrappingClass
  31. {
  32. #region Member Variables
  33. internal DomainChildCollection wrappedClass;
  34. /// <summary>
  35. /// The parent subdomain object
  36. /// </summary>
  37. protected SubDomain _subDomain = null;
  38. #endregion
  39. #region Constructor / Initialize
  40. internal ChildCollection(DomainChildCollection classToWrap)
  41. {
  42. _subDomain = classToWrap.SubDomain;
  43. wrappedClass = classToWrap;
  44. }
  45. /// <summary>
  46. /// Constructor that enables you to specify a modifier
  47. /// </summary>
  48. /// <param name="modifier">Used in audit operations to track changes</param>
  49. public ChildCollection(string modifier)
  50. {
  51. _subDomain = new SubDomain(modifier);
  52. ResetWrappedClass((DomainChildCollection)_subDomain.GetDomainCollection(Collections.ChildCollection));
  53. }
  54. /// <summary>
  55. /// The default constructor
  56. /// </summary>
  57. public ChildCollection()
  58. {
  59. _subDomain = new SubDomain(ConfigurationValues.GetInstance().Modifier);
  60. ResetWrappedClass((DomainChildCollection)_subDomain.GetDomainCollection(Collections.ChildCollection));
  61. }
  62. #endregion
  63. #region Property Implementations
  64. /// <summary>
  65. /// Returns the internal object that this object wraps
  66. /// </summary>
  67. [System.ComponentModel.Browsable(false)]
  68. internal virtual object WrappedClass
  69. {
  70. get { return wrappedClass ; }
  71. set { wrappedClass = (DomainChildCollection)value ; }
  72. }
  73. //WrappingClass Interface
  74. object Widgetsphere.Core.DataAccess.IWrappingClass.WrappedClass
  75. {
  76. get { return this.WrappedClass; }
  77. set { this.WrappedClass = value; }
  78. }
  79. /// <summary>
  80. /// Specifies a modifier string to be used in the audit functionality
  81. /// </summary>
  82. public string Modifier
  83. {
  84. get
  85. {
  86. try
  87. {
  88. return wrappedClass.Modifier;
  89. }
  90. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  91. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  92. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  93. }
  94. internal set { wrappedClass.Modifier = value; }
  95. }
  96. /// <summary>
  97. /// A reference to the SubDomain that holds this collection
  98. /// </summary>
  99. public SubDomain SubDomain
  100. {
  101. get
  102. {
  103. try
  104. {
  105. return wrappedClass.SubDomain;
  106. }
  107. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  108. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  109. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  110. }
  111. }
  112. /// <summary>
  113. /// Returns the number of items in this collection
  114. /// </summary>
  115. public override int Count
  116. {
  117. get
  118. {
  119. try
  120. {
  121. lock (wrappedClass.SubDomain)
  122. {
  123. DataTable dt = wrappedClass.GetChanges(DataRowState.Deleted);
  124. if (dt == null) return wrappedClass.Count;
  125. else return wrappedClass.Count - dt.Rows.Count;
  126. }
  127. }
  128. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  129. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  130. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  131. }
  132. }
  133. /// <summary>
  134. /// Determines the type of object contained by this collection.
  135. /// </summary>
  136. public virtual Type ContainedType
  137. {
  138. get { return typeof(Child); }
  139. }
  140. /// <summary>
  141. /// Determines the type of collection for this object.
  142. /// </summary>
  143. public virtual Collections Collection
  144. {
  145. get { return Collections.ChildCollection; }
  146. }
  147. #endregion
  148. #region Enumerator
  149. /// <summary>
  150. /// Gets or sets the element at the specified index.
  151. /// </summary>
  152. /// <param name="index">The zero-based index of the element to get or set. </param>
  153. /// <returns>The element at the specified index.</returns>
  154. public virtual Child this[int index]
  155. {
  156. get
  157. {
  158. try
  159. {
  160. var internalEnumerator = this.GetEnumerator();
  161. internalEnumerator.Reset();
  162. int ii = -1;
  163. while(ii < index)
  164. {
  165. internalEnumerator.MoveNext();
  166. ii++;
  167. }
  168. var retval = (Child)internalEnumerator.Current;
  169. if (retval.wrappedClass == null)
  170. {
  171. if (!((0 <= index) && (index < this.Count)))
  172. throw new IndexOutOfRangeException();
  173. else
  174. throw new Exception("The item is null. This is not a valid state.");
  175. }
  176. else return (Child)internalEnumerator.Current;
  177. }
  178. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  179. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  180. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  181. }
  182. }
  183. #endregion
  184. #region Methods
  185. /// <summary>
  186. /// Create a new object to later add to this collection
  187. /// </summary>
  188. public virtual Child NewItem(int ChildId)
  189. {
  190. try
  191. {
  192. lock (wrappedClass.SubDomain)
  193. {
  194. return new Child(wrappedClass.NewItem(ChildId));
  195. }
  196. }
  197. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  198. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  199. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  200. }
  201. /// <summary>
  202. /// Create a new object to later add to this collection
  203. /// </summary>
  204. public virtual Child NewItem()
  205. {
  206. try
  207. {
  208. lock (wrappedClass.SubDomain)
  209. {
  210. return new Child(wrappedClass.NewItem());
  211. }
  212. }
  213. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  214. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  215. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  216. }
  217. /// <summary>
  218. /// Add a newly created entity to this collection.
  219. /// </summary>
  220. public virtual void AddItem(Child item)
  221. {
  222. try
  223. {
  224. lock (wrappedClass.SubDomain)
  225. {
  226. wrappedClass.AddItem((DomainChild)item.WrappedClass);
  227. }
  228. }
  229. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  230. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  231. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  232. }
  233. /// <summary>
  234. /// Determines if the specified item exists in this list
  235. /// </summary>
  236. /// <param name="item"></param>
  237. /// <returns></returns>
  238. public virtual bool Contains(Acme.TestModel.Business.Objects.Child item)
  239. {
  240. foreach (var o in this)
  241. {
  242. if (o == item) return true;
  243. }
  244. return false;
  245. }
  246. /// <summary>
  247. /// Determines the position in the list of the specified item, if it exists
  248. /// </summary>
  249. /// <param name="item"></param>
  250. /// <returns></returns>
  251. public virtual int IndexOf(Acme.TestModel.Business.Objects.Child item)
  252. {
  253. int index = 0;
  254. foreach (var o in this)
  255. {
  256. if (o == item) return index;
  257. index++;
  258. }
  259. return -1;
  260. }
  261. #region IListSource Members
  262. bool System.ComponentModel.IListSource.ContainsListCollection
  263. {
  264. get { return true; }
  265. }
  266. System.Collections.IList System.ComponentModel.IListSource.GetList()
  267. {
  268. var list = new System.Collections.Generic.List<Acme.TestModel.Business.Objects.Child>();
  269. list.AddRange(this);
  270. return list;
  271. }
  272. #endregion
  273. #region IList Members
  274. int System.Collections.IList.Add(object value)
  275. {
  276. if (!(value is Acme.TestModel.Business.Objects.Child))
  277. throw new System.Exception("The specified type is not valid!");
  278. var item = value as Acme.TestModel.Business.Objects.Child;
  279. this.AddItem(item);
  280. return this.Count;
  281. }
  282. void System.Collections.IList.Clear()
  283. {
  284. throw new System.NotImplementedException();
  285. }
  286. bool System.Collections.IList.Contains(object value)
  287. {
  288. if (!(value is Acme.TestModel.Business.Objects.Child))
  289. throw new System.Exception("The specified type is not valid!");
  290. var item = value as Acme.TestModel.Business.Objects.Child;
  291. return this.Contains(item);
  292. }
  293. int System.Collections.IList.IndexOf(object value)
  294. {
  295. if (!(value is Acme.TestModel.Business.Objects.Child))
  296. throw new System.Exception("The specified type is not valid!");
  297. var item = value as Acme.TestModel.Business.Objects.Child;
  298. return this.IndexOf(item);
  299. }
  300. void System.Collections.IList.Insert(int index, object value)
  301. {
  302. throw new System.NotImplementedException();
  303. }
  304. bool System.Collections.IList.IsFixedSize
  305. {
  306. get { return false; }
  307. }
  308. bool System.Collections.IList.IsReadOnly
  309. {
  310. get { return false; }
  311. }
  312. void System.Collections.IList.Remove(object value)
  313. {
  314. if (!(value is Acme.TestModel.Business.Objects.Child))
  315. throw new System.Exception("The specified type is not valid!");
  316. var item = value as Acme.TestModel.Business.Objects.Child;
  317. if (this.Contains(item))
  318. item.Delete();
  319. }
  320. void System.Collections.IList.RemoveAt(int index)
  321. {
  322. if ((0 <= index) && (index < this.Count))
  323. this[index].Delete();
  324. }
  325. object System.Collections.IList.this[int index]
  326. {
  327. get { return this[index]; }
  328. set { throw new System.NotImplementedException(); }
  329. }
  330. #endregion
  331. /// <summary>
  332. /// Takes an IVisitor object and iterates through each item in this collection
  333. /// </summary>
  334. /// <param name="visitor">The object that processes each collection item</param>
  335. public virtual void ProcessVisitor(IVisitor visitor)
  336. {
  337. if (visitor == null) throw new Exception("This object cannot be null.");
  338. lock(this)
  339. {
  340. foreach (IBusinessObject item in this)
  341. {
  342. visitor.Visit(item);
  343. }
  344. }
  345. }
  346. #region Static SQL Methods
  347. internal static string GetFieldAliasFromFieldNameSqlMapping(string alias)
  348. {
  349. alias = alias.Replace("[", string.Empty).Replace("]", string.Empty);
  350. switch (alias.ToLower())
  351. {
  352. case "child_id": return "childid";
  353. case "fparent_id": return "fparentid";
  354. case "name": return "name2";
  355. case "created_date": return "createddate";
  356. case "created_by": return "createdby";
  357. case "modified_date": return "modifieddate";
  358. case "modified_by": return "modifiedby";
  359. case "time_stamp": return "timestamp";
  360. default: throw new Exception("The select clause is not valid.");
  361. }
  362. }
  363. internal static string GetTableFromFieldAliasSqlMapping(string alias)
  364. {
  365. switch (alias.ToLower())
  366. {
  367. case "childid": return "CHILD";
  368. case "fparentid": return "CHILD";
  369. case "name2": return "CHILD";
  370. case "createdby": return "CHILD";
  371. case "createddate": return "CHILD";
  372. case "modifiedby": return "CHILD";
  373. case "modifieddate": return "CHILD";
  374. case "timestamp": return "CHILD";
  375. default: throw new Exception("The select clause is not valid.");
  376. }
  377. }
  378. internal static string GetTableFromFieldNameSqlMapping(string field)
  379. {
  380. switch (field.ToLower())
  381. {
  382. case "child_id": return "CHILD";
  383. case "fparent_id": return "CHILD";
  384. case "name": return "CHILD";
  385. case "created_by": return "CHILD";
  386. case "created_date": return "CHILD";
  387. case "modified_by": return "CHILD";
  388. case "modified_date": return "CHILD";
  389. case "time_stamp": return "CHILD";
  390. default: throw new Exception("The select clause is not valid.");
  391. }
  392. }
  393. internal static string GetRemappedLinqSql(string sql, string parentAlias, LinqSQLFromClauseCollection childTables)
  394. {
  395. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[child_id\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[child_id]", RegexOptions.IgnoreCase);
  396. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[fparent_id\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[fparent_id]", RegexOptions.IgnoreCase);
  397. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[name\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[name]", RegexOptions.IgnoreCase);
  398. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createdby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[createdby]", RegexOptions.IgnoreCase);
  399. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[createddate]", RegexOptions.IgnoreCase);
  400. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifiedby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[modifiedby]", RegexOptions.IgnoreCase);
  401. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifieddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[modifieddate]", RegexOptions.IgnoreCase);
  402. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[timestamp\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "CHILD") + "].[timestamp]", RegexOptions.IgnoreCase);
  403. return sql;
  404. }
  405. internal static string GetPagedSQL(List<LinqSQLField> fieldList, LinqSQLFromClauseCollection fromLinkList, string whereClause, object paging, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  406. {
  407. var sb = new StringBuilder();
  408. var paging2 = (ChildPaging)paging;
  409. //Calculate the SELECT clause
  410. sb.Append("SELECT ");
  411. int index = 0;
  412. foreach (LinqSQLField field in fieldList)
  413. {
  414. sb.Append("[t0].[" + field.Name + "]");
  415. if (index < fieldList.Count - 1) sb.Append(", ");
  416. index++;
  417. }
  418. sb.AppendLine();
  419. sb.AppendLine("FROM (");
  420. //Calculate the Inner SELECT clause
  421. sb.Append("SELECT ");
  422. index = 0;
  423. foreach (var field in fieldList)
  424. {
  425. sb.Append(field.GetSQL(false));
  426. if (index < fieldList.Count - 1) sb.Append(", ");
  427. index++;
  428. }
  429. sb.AppendLine();
  430. //If there is no sort then add primary key
  431. if (paging2.OrderByList.Count == 0)
  432. {
  433. paging2.OrderByList.Add(new ChildPagingFieldItem(Child.FieldNameConstants.ChildId));
  434. }
  435. //Determine the paging sort
  436. var isPrimary = false;
  437. var orderByClause = string.Empty;
  438. foreach (var fieldItem in paging2.OrderByList)
  439. {
  440. if (!string.IsNullOrEmpty(orderByClause)) orderByClause += ", ";
  441. switch (fieldItem.Field.ToString().ToLower())
  442. {
  443. case "childid": orderByClause += "[" + (from x in fieldList where x.Alias.ToLower() == fieldItem.Field.ToString().ToLower() select x).FirstOrDefault().Table + "].[child_id]" + (fieldItem.Ascending ? string.Empty : " DESC"); isPrimary = true;break;
  444. case "fparentid": orderByClause += "[" + (from x in fieldList where x.Alias.ToLower() == fieldItem.Field.ToString().ToLower() select x).FirstOrDefault().Table + "].[fparent_id]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  445. case "name2": orderByClause += "[" + (from x in fieldList where x.Alias.ToLower() == fieldItem.Field.ToString().ToLower() select x).FirstOrDefault().Table + "].[name]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  446. case "createddate": orderByClause += "[t0].[created_date]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  447. case "createdby": orderByClause += "[t0].[created_by]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  448. case "modifieddate": orderByClause += "[t0].[modified_date]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  449. case "modifiedby": orderByClause += "[t0].[modified_by]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  450. case "timestamp": orderByClause += "[t0].[time_stamp]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  451. default: throw new Exception("The order by clause is not valid.");
  452. }
  453. }
  454. //Get the primary key for predictable sorts
  455. string primarySortKey = string.Empty;
  456. primarySortKey = "[t0].[child_id]";
  457. sb.AppendLine(", ROW_NUMBER() OVER (ORDER BY " + orderByClause + ((primarySortKey == string.Empty) || ((isPrimary && (!string.IsNullOrEmpty(primarySortKey)))) ? string.Empty : ", " + primarySortKey) + ") AS Row");
  458. //Calculate the FROM clause
  459. index = 0;
  460. sb.Append("FROM ");
  461. foreach (LinqSQLFromClause fromClause in fromLinkList)
  462. {
  463. sb.Append("[" + fromClause.Schema + "].[" + fromClause.TableName + "] AS [" + fromClause.Alias + "] ");
  464. if (optimizer.NoLocking) sb.Append("WITH (NOLOCK)");
  465. if (!string.IsNullOrEmpty(fromClause.LinkClause)) sb.Append(fromClause.LinkClause + " ");
  466. if (index < fromLinkList.Count - 1)
  467. {
  468. sb.AppendLine();
  469. sb.Append("LEFT OUTER JOIN ");
  470. }
  471. index++;
  472. }
  473. sb.AppendLine();
  474. //Calculate the WHERE clause
  475. if (!string.IsNullOrEmpty(whereClause))
  476. {
  477. foreach (LinqSQLFromClause fromClause in fromLinkList)
  478. {
  479. //Only process table that were original and not inserted above
  480. if (fromClause.AnchorAlias == string.Empty)
  481. {
  482. whereClause = LinqSQLParser.GetRemappedLinqSql(fromClause, whereClause, fromLinkList, LinqSQLParser.ObjectTypeConstants.Table);
  483. }
  484. }
  485. sb.Append("WHERE " + whereClause);
  486. }
  487. sb.AppendLine(") AS [t0]");
  488. sb.AppendLine("WHERE (Row >= " + (((paging2.PageIndex - 1) * paging2.RecordsperPage) + 1) + ") AND (Row <= " + (paging2.PageIndex * paging2.RecordsperPage) + ")");
  489. return sb.ToString();
  490. }
  491. #endregion
  492. /// <summary>
  493. /// Persists this collection to store.
  494. /// </summary>
  495. public override void Persist()
  496. {
  497. try
  498. {
  499. foreach (Child item in this)
  500. {
  501. if (item.wrappedClass.RowState != DataRowState.Unchanged)
  502. item.OnValidate(new BusinessObjectEventArgs(item));
  503. }
  504. lock (wrappedClass.SubDomain)
  505. {
  506. wrappedClass.Persist();
  507. }
  508. }
  509. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  510. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  511. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  512. }
  513. /// <summary>
  514. /// Select all objects from store.
  515. /// </summary>
  516. public static ChildCollection RunSelect()
  517. {
  518. return RunSelect(ConfigurationValues.GetInstance().Modifier);
  519. }
  520. /// <summary>
  521. /// Select all objects from store.
  522. /// </summary>
  523. public static ChildCollection RunSelect(string modifier)
  524. {
  525. try
  526. {
  527. var returnVal = new ChildCollection(DomainChildCollection.RunSelect(modifier));
  528. return returnVal;
  529. }
  530. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  531. catch (System.Data.SqlClient.SqlException sqlexp) { if (sqlexp.Number == 547 || sqlexp.Number == 2627) throw new Widgetsphere.Core.Exceptions.UniqueConstraintViolatedException(GlobalValues.ERROR_CONSTRAINT_FAILURE, sqlexp); else throw; }
  532. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  533. }
  534. /// <summary>
  535. /// Using the specified Where expression, execute a query against the database to return a result set
  536. /// </summary>
  537. /// <param name="where">The expression that determines the records selected</param>
  538. public static ChildCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  539. {
  540. return RunSelect(where, ConfigurationValues.GetInstance().Modifier);
  541. }
  542. /// <summary>
  543. /// Using the specified Where expression, execute a query against the database to return a result set
  544. /// </summary>
  545. /// <param name="where">The expression that determines the records selected</param>
  546. /// <param name="modifier">The modified audit trail</param>
  547. public static ChildCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, string modifier)
  548. {
  549. return RunSelect(where, new QueryOptimizer(), modifier);
  550. }
  551. /// <summary>
  552. /// Using the specified Where expression, execute a query against the database to return a result set
  553. /// </summary>
  554. /// <param name="where">The expression that determines the records selected</param>
  555. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  556. /// <param name="modifier">The modified audit trail</param>
  557. public static ChildCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer, string modifier)
  558. {
  559. var subDomain = new SubDomain(modifier);
  560. var dc = new DataContext(ConfigurationValues.GetInstance().ConnectionString);
  561. var template = dc.GetTable<ChildQuery>();
  562. var cmd = BusinessCollectionPersistableBase.GetCommand<ChildQuery>(dc, template, where);
  563. cmd.CommandTimeout = ConfigurationValues.GetInstance().DefaultTimeOut;
  564. var parser = LinqSQLParser.Create(cmd.CommandText, LinqSQLParser.ObjectTypeConstants.Table);
  565. cmd.CommandText = parser.GetSQL(optimizer);
  566. dc.Connection.Open();
  567. var startTime = DateTime.Now;
  568. var result = dc.Translate<ChildQuery>(cmd.ExecuteReader());
  569. var endTime = DateTime.Now;
  570. optimizer.TotalMilliseconds = (long)endTime.Subtract(startTime).TotalMilliseconds;
  571. var retval = subDomain.GetCollection<ChildCollection>();
  572. var pkList = new HashSet<string>();
  573. foreach (var item in result)
  574. {
  575. var pk = item.SinglePrimaryKeyValue();
  576. if (!pkList.Contains(pk))
  577. {
  578. pkList.Add(pk);
  579. var newItem = retval.NewItem(item.ChildId);
  580. LoadDataRow(item, newItem);
  581. retval.AddItem(newItem);
  582. }
  583. }
  584. retval.wrappedClass.AcceptChanges();
  585. retval.wrappedClass.EndLoadData();
  586. dc.Connection.Close();
  587. return retval;
  588. }
  589. /// <summary>
  590. /// Using the specified Where expression, execute a query against the database to return a result set
  591. /// </summary>
  592. /// <param name="where">The expression that determines the records selected</param>
  593. /// <param name="paging">The paging object to determine how the results are paged.</param>
  594. public static ChildCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Acme.TestModel.Business.Objects.ChildPaging paging)
  595. {
  596. return RunSelect(where, paging, ConfigurationValues.GetInstance().Modifier);
  597. }
  598. /// <summary>
  599. /// Using the specified Where expression, execute a query against the database to return a result set
  600. /// </summary>
  601. /// <param name="where">The expression that determines the records selected</param>
  602. /// <param name="paging">The paging object to determine how the results are paged.</param>
  603. /// <param name="modifier">The modified audit trail</param>
  604. public static ChildCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Acme.TestModel.Business.Objects.ChildPaging paging, string modifier)
  605. {
  606. return RunSelect(where, paging, new QueryOptimizer(), modifier);
  607. }
  608. /// <summary>
  609. /// Using the specified Where expression, execute a query against the database to return a result set
  610. /// </summary>
  611. /// <param name="where">The expression that determines the records selected</param>
  612. /// <param name="paging">The paging object to determine how the results are paged.</param>
  613. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  614. /// <param name="modifier">The modified audit trail</param>
  615. public static ChildCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Acme.TestModel.Business.Objects.ChildPaging paging, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer, string modifier)
  616. {
  617. if (paging == null) throw new Exception("The paging object cannot be null.");
  618. var subDomain = new SubDomain(modifier);
  619. var dc = new DataContext(ConfigurationValues.GetInstance().ConnectionString);
  620. var template = dc.GetTable<ChildQuery>();
  621. var cmd = BusinessCollectionPersistableBase.GetCommand<ChildQuery>(dc, template, where);
  622. cmd.CommandTimeout = ConfigurationValues.GetInstance().DefaultTimeOut;
  623. var parser = LinqSQLParser.Create(cmd.CommandText, paging, LinqSQLParser.ObjectTypeConstants.Table);
  624. cmd.CommandText = parser.GetSQL(optimizer);
  625. dc.Connection.Open();
  626. var startTime = DateTime.Now;
  627. var result = dc.Translate<ChildQuery>(cmd.ExecuteReader());
  628. var endTime = DateTime.Now;
  629. optimizer.TotalMilliseconds = (long)endTime.Subtract(startTime).TotalMilliseconds;
  630. var retval = subDomain.GetCollection<ChildCollection>();
  631. var pkList = new HashSet<string>();
  632. foreach (var item in result)
  633. {
  634. var pk = item.SinglePrimaryKeyValue();
  635. if (!pkList.Contains(pk))
  636. {
  637. pkList.Add(pk);
  638. var newItem = retval.NewItem(item.ChildId);
  639. LoadDataRow(item, newItem);
  640. retval.AddItem(newItem);
  641. }
  642. }
  643. retval.wrappedClass.AcceptChanges();
  644. retval.wrappedClass.EndLoadData();
  645. dc.Connection.Close();
  646. paging.RecordCount = GetCount(where);
  647. return retval;
  648. }
  649. private static void LoadDataRow(ChildQuery item, Child newItem)
  650. {
  651. newItem.wrappedClass["child_id"] = item.ChildId;
  652. newItem.wrappedClass["name"] = item.Name2;
  653. newItem.wrappedClass["fparent_id"] = item.FparentId;
  654. newItem.wrappedClass["CreatedDate"] = StringHelper.ConvertToDatabase(item.CreatedDate);
  655. newItem.wrappedClass["CreatedBy"] = StringHelper.ConvertToDatabase(item.CreatedBy);
  656. newItem.wrappedClass["ModifiedDate"] = StringHelper.ConvertToDatabase(item.ModifiedDate);
  657. newItem.wrappedClass["ModifiedBy"] = StringHelper.ConvertToDatabase(item.ModifiedBy);
  658. newItem.wrappedClass["TimeStamp"] = item.TimeStamp;
  659. }
  660. /// <summary>
  661. /// Get the maximum value of the field for all objects
  662. /// </summary>
  663. /// <param name="select">The field to aggregate</param>
  664. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int>> select)
  665. {
  666. return GetMax(select, x => true);
  667. }
  668. /// <summary>
  669. /// Get the maximum value of the field in the set of records that match the Where condition
  670. /// </summary>
  671. /// <param name="select">The field to aggregate</param>
  672. /// <param name="where">The expression that determines the records selected</param>
  673. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  674. {
  675. return GetMax(select, where, new QueryOptimizer());
  676. }
  677. /// <summary>
  678. /// Get the maximum value of the field in the set of records that match the Where condition
  679. /// </summary>
  680. /// <param name="select">The field to aggregate</param>
  681. /// <param name="where">The expression that determines the records selected</param>
  682. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  683. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  684. {
  685. return BusinessObjectQuery<Child, ChildQuery, int>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  686. }
  687. /// <summary>
  688. /// Get the maximum value of the field for all objects
  689. /// </summary>
  690. /// <param name="select">The field to aggregate</param>
  691. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int?>> select)
  692. {
  693. return GetMax(select, x => true);
  694. }
  695. /// <summary>
  696. /// Get the maximum value of the field in the set of records that match the Where condition
  697. /// </summary>
  698. /// <param name="select">The field to aggregate</param>
  699. /// <param name="where">The expression that determines the records selected</param>
  700. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  701. {
  702. return GetMax(select, where, new QueryOptimizer());
  703. }
  704. /// <summary>
  705. /// Get the maximum value of the field in the set of records that match the Where condition
  706. /// </summary>
  707. /// <param name="select">The field to aggregate</param>
  708. /// <param name="where">The expression that determines the records selected</param>
  709. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  710. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  711. {
  712. return BusinessObjectQuery<Child, ChildQuery, int?>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  713. }
  714. /// <summary>
  715. /// Get the maximum value of the field for all objects
  716. /// </summary>
  717. /// <param name="select">The field to aggregate</param>
  718. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, Single>> select)
  719. {
  720. return GetMax(select, x => true);
  721. }
  722. /// <summary>
  723. /// Get the maximum value of the field in the set of records that match the Where condition
  724. /// </summary>
  725. /// <param name="select">The field to aggregate</param>
  726. /// <param name="where">The expression that determines the records selected</param>
  727. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, Single>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  728. {
  729. return GetMax(select, where, new QueryOptimizer());
  730. }
  731. /// <summary>
  732. /// Get the maximum value of the field in the set of records that match the Where condition
  733. /// </summary>
  734. /// <param name="select">The field to aggregate</param>
  735. /// <param name="where">The expression that determines the records selected</param>
  736. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  737. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, Single>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  738. {
  739. return BusinessObjectQuery<Child, ChildQuery, Single>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  740. }
  741. /// <summary>
  742. /// Get the maximum value of the field for all objects
  743. /// </summary>
  744. /// <param name="select">The field to aggregate</param>
  745. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, Single?>> select)
  746. {
  747. return GetMax(select, x => true);
  748. }
  749. /// <summary>
  750. /// Get the maximum value of the field in the set of records that match the Where condition
  751. /// </summary>
  752. /// <param name="select">The field to aggregate</param>
  753. /// <param name="where">The expression that determines the records selected</param>
  754. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, Single?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  755. {
  756. return GetMax(select, where, new QueryOptimizer());
  757. }
  758. /// <summary>
  759. /// Get the maximum value of the field in the set of records that match the Where condition
  760. /// </summary>
  761. /// <param name="select">The field to aggregate</param>
  762. /// <param name="where">The expression that determines the records selected</param>
  763. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  764. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, Single?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  765. {
  766. return BusinessObjectQuery<Child, ChildQuery, Single?>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  767. }
  768. /// <summary>
  769. /// Get the maximum value of the field for all objects
  770. /// </summary>
  771. /// <param name="select">The field to aggregate</param>
  772. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, double>> select)
  773. {
  774. return GetMax(select, x => true);
  775. }
  776. /// <summary>
  777. /// Get the maximum value of the field in the set of records that match the Where condition
  778. /// </summary>
  779. /// <param name="select">The field to aggregate</param>
  780. /// <param name="where">The expression that determines the records selected</param>
  781. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, double>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  782. {
  783. return GetMax(select, where, new QueryOptimizer());
  784. }
  785. /// <summary>
  786. /// Get the maximum value of the field in the set of records that match the Where condition
  787. /// </summary>
  788. /// <param name="select">The field to aggregate</param>
  789. /// <param name="where">The expression that determines the records selected</param>
  790. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  791. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, double>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  792. {
  793. return BusinessObjectQuery<Child, ChildQuery, double>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  794. }
  795. /// <summary>
  796. /// Get the maximum value of the field for all objects
  797. /// </summary>
  798. /// <param name="select">The field to aggregate</param>
  799. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, double?>> select)
  800. {
  801. return GetMax(select, x => true);
  802. }
  803. /// <summary>
  804. /// Get the maximum value of the field in the set of records that match the Where condition
  805. /// </summary>
  806. /// <param name="select">The field to aggregate</param>
  807. /// <param name="where">The expression that determines the records selected</param>
  808. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, double?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  809. {
  810. return GetMax(select, where, new QueryOptimizer());
  811. }
  812. /// <summary>
  813. /// Get the maximum value of the field in the set of records that match the Where condition
  814. /// </summary>
  815. /// <param name="select">The field to aggregate</param>
  816. /// <param name="where">The expression that determines the records selected</param>
  817. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  818. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, double?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  819. {
  820. return BusinessObjectQuery<Child, ChildQuery, double?>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  821. }
  822. /// <summary>
  823. /// Get the maximum value of the field for all objects
  824. /// </summary>
  825. /// <param name="select">The field to aggregate</param>
  826. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, decimal>> select)
  827. {
  828. return GetMax(select, x => true);
  829. }
  830. /// <summary>
  831. /// Get the maximum value of the field in the set of records that match the Where condition
  832. /// </summary>
  833. /// <param name="select">The field to aggregate</param>
  834. /// <param name="where">The expression that determines the records selected</param>
  835. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, decimal>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  836. {
  837. return GetMax(select, where, new QueryOptimizer());
  838. }
  839. /// <summary>
  840. /// Get the maximum value of the field in the set of records that match the Where condition
  841. /// </summary>
  842. /// <param name="select">The field to aggregate</param>
  843. /// <param name="where">The expression that determines the records selected</param>
  844. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  845. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, decimal>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  846. {
  847. return BusinessObjectQuery<Child, ChildQuery, decimal>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  848. }
  849. /// <summary>
  850. /// Get the maximum value of the field for all objects
  851. /// </summary>
  852. /// <param name="select">The field to aggregate</param>
  853. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, decimal?>> select)
  854. {
  855. return GetMax(select, x => true);
  856. }
  857. /// <summary>
  858. /// Get the maximum value of the field in the set of records that match the Where condition
  859. /// </summary>
  860. /// <param name="select">The field to aggregate</param>
  861. /// <param name="where">The expression that determines the records selected</param>
  862. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, decimal?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  863. {
  864. return GetMax(select, where, new QueryOptimizer());
  865. }
  866. /// <summary>
  867. /// Get the maximum value of the field in the set of records that match the Where condition
  868. /// </summary>
  869. /// <param name="select">The field to aggregate</param>
  870. /// <param name="where">The expression that determines the records selected</param>
  871. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  872. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, decimal?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  873. {
  874. return BusinessObjectQuery<Child, ChildQuery, decimal?>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  875. }
  876. /// <summary>
  877. /// Get the maximum value of the field for all objects
  878. /// </summary>
  879. /// <param name="select">The field to aggregate</param>
  880. public static string GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, string>> select)
  881. {
  882. return GetMax(select, x => true);
  883. }
  884. /// <summary>
  885. /// Get the maximum value of the field in the set of records that match the Where condition
  886. /// </summary>
  887. /// <param name="select">The field to aggregate</param>
  888. /// <param name="where">The expression that determines the records selected</param>
  889. public static string GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, string>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  890. {
  891. return GetMax(select, where, new QueryOptimizer());
  892. }
  893. /// <summary>
  894. /// Get the maximum value of the field in the set of records that match the Where condition
  895. /// </summary>
  896. /// <param name="select">The field to aggregate</param>
  897. /// <param name="where">The expression that determines the records selected</param>
  898. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  899. public static string GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, string>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  900. {
  901. return BusinessObjectQuery<Child, ChildQuery, string>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  902. }
  903. /// <summary>
  904. /// Get the maximum value of the field for all objects
  905. /// </summary>
  906. /// <param name="select">The field to aggregate</param>
  907. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, DateTime>> select)
  908. {
  909. return GetMax(select, x => true);
  910. }
  911. /// <summary>
  912. /// Get the maximum value of the field in the set of records that match the Where condition
  913. /// </summary>
  914. /// <param name="select">The field to aggregate</param>
  915. /// <param name="where">The expression that determines the records selected</param>
  916. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, DateTime>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  917. {
  918. return GetMax(select, where, new QueryOptimizer());
  919. }
  920. /// <summary>
  921. /// Get the maximum value of the field in the set of records that match the Where condition
  922. /// </summary>
  923. /// <param name="select">The field to aggregate</param>
  924. /// <param name="where">The expression that determines the records selected</param>
  925. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  926. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, DateTime>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  927. {
  928. return BusinessObjectQuery<Child, ChildQuery, DateTime>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  929. }
  930. /// <summary>
  931. /// Get the maximum value of the field for all objects
  932. /// </summary>
  933. /// <param name="select">The field to aggregate</param>
  934. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, DateTime?>> select)
  935. {
  936. return GetMax(select, x => true);
  937. }
  938. /// <summary>
  939. /// Get the maximum value of the field in the set of records that match the Where condition
  940. /// </summary>
  941. /// <param name="select">The field to aggregate</param>
  942. /// <param name="where">The expression that determines the records selected</param>
  943. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, DateTime?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  944. {
  945. return GetMax(select, where, new QueryOptimizer());
  946. }
  947. /// <summary>
  948. /// Get the maximum value of the field in the set of records that match the Where condition
  949. /// </summary>
  950. /// <param name="select">The field to aggregate</param>
  951. /// <param name="where">The expression that determines the records selected</param>
  952. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  953. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, DateTime?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  954. {
  955. return BusinessObjectQuery<Child, ChildQuery, DateTime?>.GetMax(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  956. }
  957. /// <summary>
  958. /// Get the minimum value of the field for all objects
  959. /// </summary>
  960. /// <param name="select">The field to aggregate</param>
  961. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int>> select)
  962. {
  963. return GetMin(select, x => true);
  964. }
  965. /// <summary>
  966. /// Get the minimum value of the field in the set of records that match the Where condition
  967. /// </summary>
  968. /// <param name="select">The field to aggregate</param>
  969. /// <param name="where">The expression that determines the records selected</param>
  970. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  971. {
  972. return GetMin(select, where, new QueryOptimizer());
  973. }
  974. /// <summary>
  975. /// Get the minimum value of the field in the set of records that match the Where condition
  976. /// </summary>
  977. /// <param name="select">The field to aggregate</param>
  978. /// <param name="where">The expression that determines the records selected</param>
  979. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  980. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  981. {
  982. return BusinessObjectQuery<Child, ChildQuery, int>.GetMin(select, where, optimizer, "CHILD", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  983. }
  984. /// <summary>
  985. /// Get the minimum value of the field for all objects
  986. /// </summary>
  987. /// <param name="select">The field to aggregate</param>
  988. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int?>> select)
  989. {
  990. return GetMin(select, x => true);
  991. }
  992. /// <summary>
  993. /// Get the minimum value of the field in the set of records that match the Where condition
  994. /// </summary>
  995. /// <param name="select">The field to aggregate</param>
  996. /// <param name="where">The expression that determines the records selected</param>
  997. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ChildQuery, bool>> where)
  998. {
  999. return GetMin(select, where, new QueryOptimizer());
  1000. }
  1001. /// <summary>
  1002. /// Get the minimum value of the field in the set of records that match the Where condition
  1003. /// </summary>
  1004. /// <param name="select">The field to aggregate</param>
  1005. /// <param name="where">The expression that determines the records selected</param>
  1006. /// <param name="optimizer">An object to specify querying parameters and return profil…

Large files files are truncated, but you can click here to view the full file