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

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

#
C# | 1374 lines | 786 code | 140 blank | 448 comment | 81 complexity | 93231493005bc2a5461426ef1b588882 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 'ParentType' entities
  27. /// </summary>
  28. [Serializable()]
  29. public partial class ParentTypeCollection : Widgetsphere.Core.DataAccess.BusinessCollectionBase, Widgetsphere.Core.DataAccess.IBusinessCollection, System.IDisposable, System.ComponentModel.IListSource, System.Collections.IList, System.Collections.IEnumerator, System.Collections.Generic.IEnumerable<Acme.TestModel.Business.Objects.ParentType>, Widgetsphere.Core.DataAccess.IWrappingClass
  30. {
  31. #region Member Variables
  32. internal DomainParentTypeCollection wrappedClass;
  33. /// <summary>
  34. /// The parent subdomain object
  35. /// </summary>
  36. protected SubDomain _subDomain = null;
  37. #endregion
  38. #region Constructor / Initialize
  39. internal ParentTypeCollection(DomainParentTypeCollection 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 ParentTypeCollection(string modifier)
  49. {
  50. _subDomain = new SubDomain(modifier);
  51. ResetWrappedClass((DomainParentTypeCollection)_subDomain.GetDomainCollection(Collections.ParentTypeCollection));
  52. }
  53. /// <summary>
  54. /// The default constructor
  55. /// </summary>
  56. public ParentTypeCollection()
  57. {
  58. _subDomain = new SubDomain(ConfigurationValues.GetInstance().Modifier);
  59. ResetWrappedClass((DomainParentTypeCollection)_subDomain.GetDomainCollection(Collections.ParentTypeCollection));
  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 = (DomainParentTypeCollection)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(ParentType); }
  138. }
  139. /// <summary>
  140. /// Determines the type of collection for this object.
  141. /// </summary>
  142. public virtual Collections Collection
  143. {
  144. get { return Collections.ParentTypeCollection; }
  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 ParentType 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 = (ParentType)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 (ParentType)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. protected internal virtual ParentType NewItem(int ParentTypeId)
  188. {
  189. try
  190. {
  191. lock (wrappedClass.SubDomain)
  192. {
  193. return new ParentType(wrappedClass.NewItem(ParentTypeId));
  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. protected internal virtual ParentType NewItem()
  204. {
  205. try
  206. {
  207. lock (wrappedClass.SubDomain)
  208. {
  209. return new ParentType(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. protected internal virtual void AddItem(ParentType item)
  220. {
  221. try
  222. {
  223. lock (wrappedClass.SubDomain)
  224. {
  225. wrappedClass.AddItem((DomainParentType)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.ParentType 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.ParentType 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.ParentType>();
  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.ParentType))
  276. throw new System.Exception("The specified type is not valid!");
  277. var item = value as Acme.TestModel.Business.Objects.ParentType;
  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.ParentType))
  288. throw new System.Exception("The specified type is not valid!");
  289. var item = value as Acme.TestModel.Business.Objects.ParentType;
  290. return this.Contains(item);
  291. }
  292. int System.Collections.IList.IndexOf(object value)
  293. {
  294. if (!(value is Acme.TestModel.Business.Objects.ParentType))
  295. throw new System.Exception("The specified type is not valid!");
  296. var item = value as Acme.TestModel.Business.Objects.ParentType;
  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 true; }
  306. }
  307. bool System.Collections.IList.IsReadOnly
  308. {
  309. get { return true; }
  310. }
  311. void System.Collections.IList.Remove(object value)
  312. {
  313. //This is a read-only collection
  314. }
  315. void System.Collections.IList.RemoveAt(int index)
  316. {
  317. //This is a read-only collection
  318. }
  319. object System.Collections.IList.this[int index]
  320. {
  321. get { return this[index]; }
  322. set { throw new System.NotImplementedException(); }
  323. }
  324. #endregion
  325. /// <summary>
  326. /// Takes an IVisitor object and iterates through each item in this collection
  327. /// </summary>
  328. /// <param name="visitor">The object that processes each collection item</param>
  329. public virtual void ProcessVisitor(IVisitor visitor)
  330. {
  331. if (visitor == null) throw new Exception("This object cannot be null.");
  332. lock(this)
  333. {
  334. foreach (IBusinessObject item in this)
  335. {
  336. visitor.Visit(item);
  337. }
  338. }
  339. }
  340. #region Static SQL Methods
  341. internal static string GetFieldAliasFromFieldNameSqlMapping(string alias)
  342. {
  343. alias = alias.Replace("[", string.Empty).Replace("]", string.Empty);
  344. switch (alias.ToLower())
  345. {
  346. case "name": return "name";
  347. case "parent_type_id": return "parenttypeid";
  348. case "created_date": return "createddate";
  349. case "created_by": return "createdby";
  350. case "modified_date": return "modifieddate";
  351. case "modified_by": return "modifiedby";
  352. case "time_stamp": return "timestamp";
  353. default: throw new Exception("The select clause is not valid.");
  354. }
  355. }
  356. internal static string GetTableFromFieldAliasSqlMapping(string alias)
  357. {
  358. switch (alias.ToLower())
  359. {
  360. case "name": return "PARENT_TYPE";
  361. case "parenttypeid": return "PARENT_TYPE";
  362. case "createdby": return "PARENT_TYPE";
  363. case "createddate": return "PARENT_TYPE";
  364. case "modifiedby": return "PARENT_TYPE";
  365. case "modifieddate": return "PARENT_TYPE";
  366. case "timestamp": return "PARENT_TYPE";
  367. default: throw new Exception("The select clause is not valid.");
  368. }
  369. }
  370. internal static string GetTableFromFieldNameSqlMapping(string field)
  371. {
  372. switch (field.ToLower())
  373. {
  374. case "name": return "PARENT_TYPE";
  375. case "parent_type_id": return "PARENT_TYPE";
  376. case "created_by": return "PARENT_TYPE";
  377. case "created_date": return "PARENT_TYPE";
  378. case "modified_by": return "PARENT_TYPE";
  379. case "modified_date": return "PARENT_TYPE";
  380. case "time_stamp": return "PARENT_TYPE";
  381. default: throw new Exception("The select clause is not valid.");
  382. }
  383. }
  384. internal static string GetRemappedLinqSql(string sql, string parentAlias, LinqSQLFromClauseCollection childTables)
  385. {
  386. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[name\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[name]", RegexOptions.IgnoreCase);
  387. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[parent_type_id\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[parent_type_id]", RegexOptions.IgnoreCase);
  388. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createdby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[createdby]", RegexOptions.IgnoreCase);
  389. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[createddate]", RegexOptions.IgnoreCase);
  390. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifiedby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[modifiedby]", RegexOptions.IgnoreCase);
  391. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifieddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[modifieddate]", RegexOptions.IgnoreCase);
  392. sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[timestamp\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "PARENT_TYPE") + "].[timestamp]", RegexOptions.IgnoreCase);
  393. return sql;
  394. }
  395. internal static string GetPagedSQL(List<LinqSQLField> fieldList, LinqSQLFromClauseCollection fromLinkList, string whereClause, object paging, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  396. {
  397. var sb = new StringBuilder();
  398. var paging2 = (ParentTypePaging)paging;
  399. //Calculate the SELECT clause
  400. sb.Append("SELECT ");
  401. int index = 0;
  402. foreach (LinqSQLField field in fieldList)
  403. {
  404. sb.Append("[t0].[" + field.Name + "]");
  405. if (index < fieldList.Count - 1) sb.Append(", ");
  406. index++;
  407. }
  408. sb.AppendLine();
  409. sb.AppendLine("FROM (");
  410. //Calculate the Inner SELECT clause
  411. sb.Append("SELECT ");
  412. index = 0;
  413. foreach (var field in fieldList)
  414. {
  415. sb.Append(field.GetSQL(false));
  416. if (index < fieldList.Count - 1) sb.Append(", ");
  417. index++;
  418. }
  419. sb.AppendLine();
  420. //If there is no sort then add primary key
  421. if (paging2.OrderByList.Count == 0)
  422. {
  423. paging2.OrderByList.Add(new ParentTypePagingFieldItem(ParentType.FieldNameConstants.ParentTypeId));
  424. }
  425. //Determine the paging sort
  426. var isPrimary = false;
  427. var orderByClause = string.Empty;
  428. foreach (var fieldItem in paging2.OrderByList)
  429. {
  430. if (!string.IsNullOrEmpty(orderByClause)) orderByClause += ", ";
  431. switch (fieldItem.Field.ToString().ToLower())
  432. {
  433. 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;
  434. case "parenttypeid": orderByClause += "[" + (from x in fieldList where x.Alias.ToLower() == fieldItem.Field.ToString().ToLower() select x).FirstOrDefault().Table + "].[parent_type_id]" + (fieldItem.Ascending ? string.Empty : " DESC"); isPrimary = true;break;
  435. case "createddate": orderByClause += "[t0].[created_date]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  436. case "createdby": orderByClause += "[t0].[created_by]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  437. case "modifieddate": orderByClause += "[t0].[modified_date]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  438. case "modifiedby": orderByClause += "[t0].[modified_by]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  439. case "timestamp": orderByClause += "[t0].[time_stamp]" + (fieldItem.Ascending ? string.Empty : " DESC"); break;
  440. default: throw new Exception("The order by clause is not valid.");
  441. }
  442. }
  443. //Get the primary key for predictable sorts
  444. string primarySortKey = string.Empty;
  445. primarySortKey = "[t0].[parent_type_id]";
  446. sb.AppendLine(", ROW_NUMBER() OVER (ORDER BY " + orderByClause + ((primarySortKey == string.Empty) || ((isPrimary && (!string.IsNullOrEmpty(primarySortKey)))) ? string.Empty : ", " + primarySortKey) + ") AS Row");
  447. //Calculate the FROM clause
  448. index = 0;
  449. sb.Append("FROM ");
  450. foreach (LinqSQLFromClause fromClause in fromLinkList)
  451. {
  452. sb.Append("[" + fromClause.Schema + "].[" + fromClause.TableName + "] AS [" + fromClause.Alias + "] ");
  453. if (optimizer.NoLocking) sb.Append("WITH (NOLOCK)");
  454. if (!string.IsNullOrEmpty(fromClause.LinkClause)) sb.Append(fromClause.LinkClause + " ");
  455. if (index < fromLinkList.Count - 1)
  456. {
  457. sb.AppendLine();
  458. sb.Append("LEFT OUTER JOIN ");
  459. }
  460. index++;
  461. }
  462. sb.AppendLine();
  463. //Calculate the WHERE clause
  464. if (!string.IsNullOrEmpty(whereClause))
  465. {
  466. foreach (LinqSQLFromClause fromClause in fromLinkList)
  467. {
  468. //Only process table that were original and not inserted above
  469. if (fromClause.AnchorAlias == string.Empty)
  470. {
  471. whereClause = LinqSQLParser.GetRemappedLinqSql(fromClause, whereClause, fromLinkList, LinqSQLParser.ObjectTypeConstants.Table);
  472. }
  473. }
  474. sb.Append("WHERE " + whereClause);
  475. }
  476. sb.AppendLine(") AS [t0]");
  477. sb.AppendLine("WHERE (Row >= " + (((paging2.PageIndex - 1) * paging2.RecordsperPage) + 1) + ") AND (Row <= " + (paging2.PageIndex * paging2.RecordsperPage) + ")");
  478. return sb.ToString();
  479. }
  480. #endregion
  481. /// <summary>
  482. /// Select all objects from store.
  483. /// </summary>
  484. public static ParentTypeCollection RunSelect()
  485. {
  486. return RunSelect(ConfigurationValues.GetInstance().Modifier);
  487. }
  488. /// <summary>
  489. /// Select all objects from store.
  490. /// </summary>
  491. public static ParentTypeCollection RunSelect(string modifier)
  492. {
  493. try
  494. {
  495. var returnVal = new ParentTypeCollection(DomainParentTypeCollection.RunSelect(modifier));
  496. return returnVal;
  497. }
  498. catch (System.Data.DBConcurrencyException dbcex) { throw new Widgetsphere.Core.Exceptions.ConcurrencyException(GlobalValues.ERROR_CONCURRENCY_FAILURE, dbcex); }
  499. 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; }
  500. catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); throw; }
  501. }
  502. /// <summary>
  503. /// Using the specified Where expression, execute a query against the database to return a result set
  504. /// </summary>
  505. /// <param name="where">The expression that determines the records selected</param>
  506. public static ParentTypeCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  507. {
  508. return RunSelect(where, ConfigurationValues.GetInstance().Modifier);
  509. }
  510. /// <summary>
  511. /// Using the specified Where expression, execute a query against the database to return a result set
  512. /// </summary>
  513. /// <param name="where">The expression that determines the records selected</param>
  514. /// <param name="modifier">The modified audit trail</param>
  515. public static ParentTypeCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, string modifier)
  516. {
  517. return RunSelect(where, new QueryOptimizer(), modifier);
  518. }
  519. /// <summary>
  520. /// Using the specified Where expression, execute a query against the database to return a result set
  521. /// </summary>
  522. /// <param name="where">The expression that determines the records selected</param>
  523. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  524. /// <param name="modifier">The modified audit trail</param>
  525. public static ParentTypeCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer, string modifier)
  526. {
  527. var subDomain = new SubDomain(modifier);
  528. var dc = new DataContext(ConfigurationValues.GetInstance().ConnectionString);
  529. var template = dc.GetTable<ParentTypeQuery>();
  530. var cmd = BusinessCollectionPersistableBase.GetCommand<ParentTypeQuery>(dc, template, where);
  531. cmd.CommandTimeout = ConfigurationValues.GetInstance().DefaultTimeOut;
  532. var parser = LinqSQLParser.Create(cmd.CommandText, LinqSQLParser.ObjectTypeConstants.Table);
  533. cmd.CommandText = parser.GetSQL(optimizer);
  534. dc.Connection.Open();
  535. var startTime = DateTime.Now;
  536. var result = dc.Translate<ParentTypeQuery>(cmd.ExecuteReader());
  537. var endTime = DateTime.Now;
  538. optimizer.TotalMilliseconds = (long)endTime.Subtract(startTime).TotalMilliseconds;
  539. var retval = subDomain.GetCollection<ParentTypeCollection>();
  540. var pkList = new HashSet<string>();
  541. foreach (var item in result)
  542. {
  543. var pk = item.SinglePrimaryKeyValue();
  544. if (!pkList.Contains(pk))
  545. {
  546. pkList.Add(pk);
  547. var newItem = retval.NewItem(item.ParentTypeId);
  548. LoadDataRow(item, newItem);
  549. retval.AddItem(newItem);
  550. }
  551. }
  552. retval.wrappedClass.AcceptChanges();
  553. retval.wrappedClass.EndLoadData();
  554. dc.Connection.Close();
  555. return retval;
  556. }
  557. /// <summary>
  558. /// Using the specified Where expression, execute a query against the database to return a result set
  559. /// </summary>
  560. /// <param name="where">The expression that determines the records selected</param>
  561. /// <param name="paging">The paging object to determine how the results are paged.</param>
  562. public static ParentTypeCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Acme.TestModel.Business.Objects.ParentTypePaging paging)
  563. {
  564. return RunSelect(where, paging, ConfigurationValues.GetInstance().Modifier);
  565. }
  566. /// <summary>
  567. /// Using the specified Where expression, execute a query against the database to return a result set
  568. /// </summary>
  569. /// <param name="where">The expression that determines the records selected</param>
  570. /// <param name="paging">The paging object to determine how the results are paged.</param>
  571. /// <param name="modifier">The modified audit trail</param>
  572. public static ParentTypeCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Acme.TestModel.Business.Objects.ParentTypePaging paging, string modifier)
  573. {
  574. return RunSelect(where, paging, new QueryOptimizer(), modifier);
  575. }
  576. /// <summary>
  577. /// Using the specified Where expression, execute a query against the database to return a result set
  578. /// </summary>
  579. /// <param name="where">The expression that determines the records selected</param>
  580. /// <param name="paging">The paging object to determine how the results are paged.</param>
  581. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  582. /// <param name="modifier">The modified audit trail</param>
  583. public static ParentTypeCollection RunSelect(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Acme.TestModel.Business.Objects.ParentTypePaging paging, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer, string modifier)
  584. {
  585. if (paging == null) throw new Exception("The paging object cannot be null.");
  586. var subDomain = new SubDomain(modifier);
  587. var dc = new DataContext(ConfigurationValues.GetInstance().ConnectionString);
  588. var template = dc.GetTable<ParentTypeQuery>();
  589. var cmd = BusinessCollectionPersistableBase.GetCommand<ParentTypeQuery>(dc, template, where);
  590. cmd.CommandTimeout = ConfigurationValues.GetInstance().DefaultTimeOut;
  591. var parser = LinqSQLParser.Create(cmd.CommandText, paging, LinqSQLParser.ObjectTypeConstants.Table);
  592. cmd.CommandText = parser.GetSQL(optimizer);
  593. dc.Connection.Open();
  594. var startTime = DateTime.Now;
  595. var result = dc.Translate<ParentTypeQuery>(cmd.ExecuteReader());
  596. var endTime = DateTime.Now;
  597. optimizer.TotalMilliseconds = (long)endTime.Subtract(startTime).TotalMilliseconds;
  598. var retval = subDomain.GetCollection<ParentTypeCollection>();
  599. var pkList = new HashSet<string>();
  600. foreach (var item in result)
  601. {
  602. var pk = item.SinglePrimaryKeyValue();
  603. if (!pkList.Contains(pk))
  604. {
  605. pkList.Add(pk);
  606. var newItem = retval.NewItem(item.ParentTypeId);
  607. LoadDataRow(item, newItem);
  608. retval.AddItem(newItem);
  609. }
  610. }
  611. retval.wrappedClass.AcceptChanges();
  612. retval.wrappedClass.EndLoadData();
  613. dc.Connection.Close();
  614. paging.RecordCount = GetCount(where);
  615. return retval;
  616. }
  617. private static void LoadDataRow(ParentTypeQuery item, ParentType newItem)
  618. {
  619. newItem.wrappedClass["name"] = item.Name;
  620. newItem.wrappedClass["parent_type_id"] = item.ParentTypeId;
  621. newItem.wrappedClass["CreatedDate"] = StringHelper.ConvertToDatabase(item.CreatedDate);
  622. newItem.wrappedClass["CreatedBy"] = StringHelper.ConvertToDatabase(item.CreatedBy);
  623. newItem.wrappedClass["ModifiedDate"] = StringHelper.ConvertToDatabase(item.ModifiedDate);
  624. newItem.wrappedClass["ModifiedBy"] = StringHelper.ConvertToDatabase(item.ModifiedBy);
  625. newItem.wrappedClass["TimeStamp"] = item.TimeStamp;
  626. }
  627. /// <summary>
  628. /// Get the maximum value of the field for all objects
  629. /// </summary>
  630. /// <param name="select">The field to aggregate</param>
  631. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int>> select)
  632. {
  633. return GetMax(select, x => true);
  634. }
  635. /// <summary>
  636. /// Get the maximum value of the field in the set of records that match the Where condition
  637. /// </summary>
  638. /// <param name="select">The field to aggregate</param>
  639. /// <param name="where">The expression that determines the records selected</param>
  640. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  641. {
  642. return GetMax(select, where, new QueryOptimizer());
  643. }
  644. /// <summary>
  645. /// Get the maximum value of the field in the set of records that match the Where condition
  646. /// </summary>
  647. /// <param name="select">The field to aggregate</param>
  648. /// <param name="where">The expression that determines the records selected</param>
  649. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  650. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  651. {
  652. return BusinessObjectQuery<ParentType, ParentTypeQuery, int>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  653. }
  654. /// <summary>
  655. /// Get the maximum value of the field for all objects
  656. /// </summary>
  657. /// <param name="select">The field to aggregate</param>
  658. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int?>> select)
  659. {
  660. return GetMax(select, x => true);
  661. }
  662. /// <summary>
  663. /// Get the maximum value of the field in the set of records that match the Where condition
  664. /// </summary>
  665. /// <param name="select">The field to aggregate</param>
  666. /// <param name="where">The expression that determines the records selected</param>
  667. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  668. {
  669. return GetMax(select, where, new QueryOptimizer());
  670. }
  671. /// <summary>
  672. /// Get the maximum value of the field in the set of records that match the Where condition
  673. /// </summary>
  674. /// <param name="select">The field to aggregate</param>
  675. /// <param name="where">The expression that determines the records selected</param>
  676. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  677. public static int? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  678. {
  679. return BusinessObjectQuery<ParentType, ParentTypeQuery, int?>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  680. }
  681. /// <summary>
  682. /// Get the maximum value of the field for all objects
  683. /// </summary>
  684. /// <param name="select">The field to aggregate</param>
  685. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single>> select)
  686. {
  687. return GetMax(select, x => true);
  688. }
  689. /// <summary>
  690. /// Get the maximum value of the field in the set of records that match the Where condition
  691. /// </summary>
  692. /// <param name="select">The field to aggregate</param>
  693. /// <param name="where">The expression that determines the records selected</param>
  694. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  695. {
  696. return GetMax(select, where, new QueryOptimizer());
  697. }
  698. /// <summary>
  699. /// Get the maximum value of the field in the set of records that match the Where condition
  700. /// </summary>
  701. /// <param name="select">The field to aggregate</param>
  702. /// <param name="where">The expression that determines the records selected</param>
  703. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  704. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  705. {
  706. return BusinessObjectQuery<ParentType, ParentTypeQuery, Single>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  707. }
  708. /// <summary>
  709. /// Get the maximum value of the field for all objects
  710. /// </summary>
  711. /// <param name="select">The field to aggregate</param>
  712. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single?>> select)
  713. {
  714. return GetMax(select, x => true);
  715. }
  716. /// <summary>
  717. /// Get the maximum value of the field in the set of records that match the Where condition
  718. /// </summary>
  719. /// <param name="select">The field to aggregate</param>
  720. /// <param name="where">The expression that determines the records selected</param>
  721. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  722. {
  723. return GetMax(select, where, new QueryOptimizer());
  724. }
  725. /// <summary>
  726. /// Get the maximum value of the field in the set of records that match the Where condition
  727. /// </summary>
  728. /// <param name="select">The field to aggregate</param>
  729. /// <param name="where">The expression that determines the records selected</param>
  730. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  731. public static Single? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  732. {
  733. return BusinessObjectQuery<ParentType, ParentTypeQuery, Single?>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  734. }
  735. /// <summary>
  736. /// Get the maximum value of the field for all objects
  737. /// </summary>
  738. /// <param name="select">The field to aggregate</param>
  739. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, double>> select)
  740. {
  741. return GetMax(select, x => true);
  742. }
  743. /// <summary>
  744. /// Get the maximum value of the field in the set of records that match the Where condition
  745. /// </summary>
  746. /// <param name="select">The field to aggregate</param>
  747. /// <param name="where">The expression that determines the records selected</param>
  748. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, double>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  749. {
  750. return GetMax(select, where, new QueryOptimizer());
  751. }
  752. /// <summary>
  753. /// Get the maximum value of the field in the set of records that match the Where condition
  754. /// </summary>
  755. /// <param name="select">The field to aggregate</param>
  756. /// <param name="where">The expression that determines the records selected</param>
  757. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  758. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, double>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  759. {
  760. return BusinessObjectQuery<ParentType, ParentTypeQuery, double>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  761. }
  762. /// <summary>
  763. /// Get the maximum value of the field for all objects
  764. /// </summary>
  765. /// <param name="select">The field to aggregate</param>
  766. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, double?>> select)
  767. {
  768. return GetMax(select, x => true);
  769. }
  770. /// <summary>
  771. /// Get the maximum value of the field in the set of records that match the Where condition
  772. /// </summary>
  773. /// <param name="select">The field to aggregate</param>
  774. /// <param name="where">The expression that determines the records selected</param>
  775. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, double?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  776. {
  777. return GetMax(select, where, new QueryOptimizer());
  778. }
  779. /// <summary>
  780. /// Get the maximum value of the field in the set of records that match the Where condition
  781. /// </summary>
  782. /// <param name="select">The field to aggregate</param>
  783. /// <param name="where">The expression that determines the records selected</param>
  784. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  785. public static double? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, double?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  786. {
  787. return BusinessObjectQuery<ParentType, ParentTypeQuery, double?>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  788. }
  789. /// <summary>
  790. /// Get the maximum value of the field for all objects
  791. /// </summary>
  792. /// <param name="select">The field to aggregate</param>
  793. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, decimal>> select)
  794. {
  795. return GetMax(select, x => true);
  796. }
  797. /// <summary>
  798. /// Get the maximum value of the field in the set of records that match the Where condition
  799. /// </summary>
  800. /// <param name="select">The field to aggregate</param>
  801. /// <param name="where">The expression that determines the records selected</param>
  802. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, decimal>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  803. {
  804. return GetMax(select, where, new QueryOptimizer());
  805. }
  806. /// <summary>
  807. /// Get the maximum value of the field in the set of records that match the Where condition
  808. /// </summary>
  809. /// <param name="select">The field to aggregate</param>
  810. /// <param name="where">The expression that determines the records selected</param>
  811. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  812. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, decimal>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  813. {
  814. return BusinessObjectQuery<ParentType, ParentTypeQuery, decimal>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  815. }
  816. /// <summary>
  817. /// Get the maximum value of the field for all objects
  818. /// </summary>
  819. /// <param name="select">The field to aggregate</param>
  820. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, decimal?>> select)
  821. {
  822. return GetMax(select, x => true);
  823. }
  824. /// <summary>
  825. /// Get the maximum value of the field in the set of records that match the Where condition
  826. /// </summary>
  827. /// <param name="select">The field to aggregate</param>
  828. /// <param name="where">The expression that determines the records selected</param>
  829. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, decimal?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  830. {
  831. return GetMax(select, where, new QueryOptimizer());
  832. }
  833. /// <summary>
  834. /// Get the maximum value of the field in the set of records that match the Where condition
  835. /// </summary>
  836. /// <param name="select">The field to aggregate</param>
  837. /// <param name="where">The expression that determines the records selected</param>
  838. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  839. public static decimal? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, decimal?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  840. {
  841. return BusinessObjectQuery<ParentType, ParentTypeQuery, decimal?>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  842. }
  843. /// <summary>
  844. /// Get the maximum value of the field for all objects
  845. /// </summary>
  846. /// <param name="select">The field to aggregate</param>
  847. public static string GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, string>> select)
  848. {
  849. return GetMax(select, x => true);
  850. }
  851. /// <summary>
  852. /// Get the maximum value of the field in the set of records that match the Where condition
  853. /// </summary>
  854. /// <param name="select">The field to aggregate</param>
  855. /// <param name="where">The expression that determines the records selected</param>
  856. public static string GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, string>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  857. {
  858. return GetMax(select, where, new QueryOptimizer());
  859. }
  860. /// <summary>
  861. /// Get the maximum value of the field in the set of records that match the Where condition
  862. /// </summary>
  863. /// <param name="select">The field to aggregate</param>
  864. /// <param name="where">The expression that determines the records selected</param>
  865. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  866. public static string GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, string>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  867. {
  868. return BusinessObjectQuery<ParentType, ParentTypeQuery, string>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  869. }
  870. /// <summary>
  871. /// Get the maximum value of the field for all objects
  872. /// </summary>
  873. /// <param name="select">The field to aggregate</param>
  874. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, DateTime>> select)
  875. {
  876. return GetMax(select, x => true);
  877. }
  878. /// <summary>
  879. /// Get the maximum value of the field in the set of records that match the Where condition
  880. /// </summary>
  881. /// <param name="select">The field to aggregate</param>
  882. /// <param name="where">The expression that determines the records selected</param>
  883. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, DateTime>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  884. {
  885. return GetMax(select, where, new QueryOptimizer());
  886. }
  887. /// <summary>
  888. /// Get the maximum value of the field in the set of records that match the Where condition
  889. /// </summary>
  890. /// <param name="select">The field to aggregate</param>
  891. /// <param name="where">The expression that determines the records selected</param>
  892. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  893. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, DateTime>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  894. {
  895. return BusinessObjectQuery<ParentType, ParentTypeQuery, DateTime>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  896. }
  897. /// <summary>
  898. /// Get the maximum value of the field for all objects
  899. /// </summary>
  900. /// <param name="select">The field to aggregate</param>
  901. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, DateTime?>> select)
  902. {
  903. return GetMax(select, x => true);
  904. }
  905. /// <summary>
  906. /// Get the maximum value of the field in the set of records that match the Where condition
  907. /// </summary>
  908. /// <param name="select">The field to aggregate</param>
  909. /// <param name="where">The expression that determines the records selected</param>
  910. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, DateTime?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  911. {
  912. return GetMax(select, where, new QueryOptimizer());
  913. }
  914. /// <summary>
  915. /// Get the maximum value of the field in the set of records that match the Where condition
  916. /// </summary>
  917. /// <param name="select">The field to aggregate</param>
  918. /// <param name="where">The expression that determines the records selected</param>
  919. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  920. public static DateTime? GetMax(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, DateTime?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  921. {
  922. return BusinessObjectQuery<ParentType, ParentTypeQuery, DateTime?>.GetMax(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  923. }
  924. /// <summary>
  925. /// Get the minimum value of the field for all objects
  926. /// </summary>
  927. /// <param name="select">The field to aggregate</param>
  928. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int>> select)
  929. {
  930. return GetMin(select, x => true);
  931. }
  932. /// <summary>
  933. /// Get the minimum value of the field in the set of records that match the Where condition
  934. /// </summary>
  935. /// <param name="select">The field to aggregate</param>
  936. /// <param name="where">The expression that determines the records selected</param>
  937. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  938. {
  939. return GetMin(select, where, new QueryOptimizer());
  940. }
  941. /// <summary>
  942. /// Get the minimum value of the field in the set of records that match the Where condition
  943. /// </summary>
  944. /// <param name="select">The field to aggregate</param>
  945. /// <param name="where">The expression that determines the records selected</param>
  946. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  947. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  948. {
  949. return BusinessObjectQuery<ParentType, ParentTypeQuery, int>.GetMin(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  950. }
  951. /// <summary>
  952. /// Get the minimum value of the field for all objects
  953. /// </summary>
  954. /// <param name="select">The field to aggregate</param>
  955. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int?>> select)
  956. {
  957. return GetMin(select, x => true);
  958. }
  959. /// <summary>
  960. /// Get the minimum value of the field in the set of records that match the Where condition
  961. /// </summary>
  962. /// <param name="select">The field to aggregate</param>
  963. /// <param name="where">The expression that determines the records selected</param>
  964. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where)
  965. {
  966. return GetMin(select, where, new QueryOptimizer());
  967. }
  968. /// <summary>
  969. /// Get the minimum value of the field in the set of records that match the Where condition
  970. /// </summary>
  971. /// <param name="select">The field to aggregate</param>
  972. /// <param name="where">The expression that determines the records selected</param>
  973. /// <param name="optimizer">An object to specify querying parameters and return profiling information</param>
  974. public static int? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, int?>> select, Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, bool>> where, Widgetsphere.Core.DataAccess.QueryOptimizer optimizer)
  975. {
  976. return BusinessObjectQuery<ParentType, ParentTypeQuery, int?>.GetMin(select, where, optimizer, "PARENT_TYPE", GetDatabaseFieldName, LinqSQLParser.ObjectTypeConstants.Table);
  977. }
  978. /// <summary>
  979. /// Get the minimum value of the field for all objects
  980. /// </summary>
  981. /// <param name="select">The field to aggregate</param>
  982. public static Single? GetMin(Expression<Func<Acme.TestModel.Business.LINQ.ParentTypeQuery, Single>> select)
  983. {
  984. ret

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