Data Access Layer using LINQ question
I have avoid LINQ for a good couple of years now. probably because I don't know much about it...T-SQL has worked perfectly for me for the last 20 years so why change...anyways. I need to write a new Data Access Layer I thought I'd come intot he 21st century and switch to LINQ.
I have a standard app design:
UI--->Business Rules--->Data Access Layer
If I use LINQ in the DAL how would I return this data to the business rules?
I don't want the Business Rules to have any reference to the LINQ data structure objects.
Can I simple return tables and datasets?
My final goal will be this:
UI--->Business Rules--->WCF Data Access--->Data Access Layer
So however I return the data it must be able to be passed via a WCF service.
Any tips?
Woka
Re: Data Access Layer using LINQ question
LINQ is actually an umbrella term and there are many different flavours of LINQ. Are you talking about using LINQ to SQL specifically, or maybe LINQ to Entities (which means the Entity Framework), or something else? If you want to use DataSets and DataTables then you won't actually be using LINQ in your DAL at all. You would simply generate a typed DataSet and use TableAdapters to retrieve and save data, or even use an untyped DataSet and use DataAdapters and DbCommands to save and retrieve data. You could then use LINQ to DataSet in your BLL and/or PL to process the DataTables locally.
I think you need to determine what you're actually trying to achieve because, if you're talking about LINQ to SQL or the EF or the like then your BLL is absolutely going to reference your LINQ entities. That's the whole point.