PageRenderTime 54ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

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

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

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