LINQ- Compiled queries and data layers

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hey. I've been doing some reading and my first conclusion is that it seems
to me that LINQ to entities will be around for awhile.
Regarding performance though, before LINQ we all used stored procedures
because they are compiled and the fastest way to get data. I'd appreciate
some opinions on what the equivalent is now, i.e. best practice data layer
code using LINQ.
We also used to have wrappers for stored procs in the data layer (now LINQ
queries), and we unpacked the results into List<MyObject> in the business
layer. Opinions on the little business layer and data layer methods below
pls? Thanks for your time.

// In business layer file
public List<Product> GetSecondaryProducts(string categorySecondary)
{
List<Product> productList = new List<Product>();
Product thisProduct;

foreach (Products theProduct in
DefineSecondaryProducts(categorySecondary))
{
thisProduct = new Product();
thisProduct.Brand = theProduct.Brand;
thisProduct.ProductName = theProduct.Productname;
thisProduct.Price = theProduct.Price;

productList.Add(thisProduct);
}

return productList;
}

// In 'data' layer file
public IQueryable<Products> DefineSecondaryProducts(string
categorySecondary)
{

Quickshop35sp1 QS35sp1Entities = new Quickshop35sp1();
ObjectQuery<Products> products = QS35sp1Entities.ProductsSet;

IQueryable<Products> productsQuery =
from p in products
where p.CategorySecondary ==
categorySecondary
select p;

return productsQuery;
}


.



Relevant Pages

  • Re: Circular Referencing in C#
    ... A classic three-tiered design. ... business layer, never to the data layer. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Circular Referencing in C#
    ... > business layer, never to the data layer. ... three main frameworks that provide all the services necessary for completely ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Data Layer Relationships
    ... I dont even think you should crank out a business layer for AD that ... ActiveDirectoryDomain or from ActiveDirectoryGroup. ... Data Layer classes? ...
    (comp.object)
  • =?iso-8859-1?q?Re:_Codegeneratoren_f=FCr_WinForms-Anwendung_/_C#_und_MS-SQL_-_Er
    ... Layer nicht zu kurz kommt. ... LINQ ist grob gesehen im Business Layer ... der strikten Schichtenarchitektur zu lösen. ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: What do People do to avoid Tight Coupling?
    ... > The presentation layer is coupled to the business layer, ... > layer is coupled to the data layer. ... Actually I normally couple the presentation layer to the domain layer ...
    (microsoft.public.dotnet.languages.vb)