PageRenderTime 53ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

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

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

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