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

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

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

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