Esempio n. 1
0
 /// <summary>
 /// Fetches the individual element
 /// </summary>
 /// <param name="key">The key of the element to fetch.</param>
 /// <returns>The fetched element, or null if not found</returns>
 public override L2S.Bencher.EntityClasses.SalesOrderHeader FetchIndividual(int key)
 {
     using (var ctx = new L2SBencherDataContext())
     {
         return(ctx.SalesOrderHeaders.FirstOrDefault(e => e.SalesOrderId == key));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Fetches the complete set of elements and returns this set as an IEnumerable.
 /// </summary>
 /// <returns>the set fetched</returns>
 public override IEnumerable <L2S.Bencher.EntityClasses.SalesOrderHeader> FetchSet()
 {
     using (var ctx = new L2SBencherDataContext())
     {
         return(ctx.SalesOrderHeaders.ToList());
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Fetches the complete graph using eager loading and returns this as an IEnumerable.
 /// </summary>
 /// <returns>the graph fetched</returns>
 public override IEnumerable <L2S.Bencher.EntityClasses.SalesOrderHeader> FetchGraph()
 {
     using (var ctx = new L2SBencherDataContext())
     {
         var loadOptions = new DataLoadOptions();
         loadOptions.LoadWith <L2S.Bencher.EntityClasses.SalesOrderHeader>(soh => soh.SalesOrderDetails);
         loadOptions.LoadWith <L2S.Bencher.EntityClasses.SalesOrderHeader>(soh => soh.Customer);
         ctx.LoadOptions = loadOptions;
         return((from soh in ctx.SalesOrderHeaders
                 where soh.SalesOrderId > 50000 && soh.SalesOrderId <= 51000
                 select soh).ToList());
     }
 }