Using LINQ

Topics: Data Access Application Block
Jun 11, 2008 at 10:27 AM
Hi, can any one suggest me how to connect sql 2008 to Asp.net 3.5 using LINQ from EntLib 4.0
Jun 11, 2008 at 9:27 PM
Hi,

Can you elaborate on the kind of integration are you looking for? If you're using LINQ's syntax then you will not use EntLib's DB-agnostic API, and EntLib's implementation doesn't use LINQ. While you could use EntLib's database as a DbConnection creator to feed connections to a DataContext, it would be overkill and the ability to create connections for different ADO.NET providers would only get in the way.

Regards,
Fernando




jayashree wrote:
Hi, can any one suggest me how to connect sql 2008 to Asp.net 3.5 using LINQ from EntLib 4.0


Jun 12, 2008 at 8:50 AM


fsimonazzi wrote:
Hi,

Can you elaborate on the kind of integration are you looking for? If you're using LINQ's syntax then you will not use EntLib's DB-agnostic API, and EntLib's implementation doesn't use LINQ. While you could use EntLib's database as a DbConnection creator to feed connections to a DataContext, it would be overkill and the ability to create connections for different ADO.NET providers would only get in the way.

Regards,
Fernando




jayashree wrote:
Hi, can any one suggest me how to connect sql 2008 to Asp.net 3.5 using LINQ from EntLib 4.0



Hi,

I am not sure of the EntLib's API, formely I hava used DatabaseFactory to connect sqlserver 2005, can I know what is the best way to connect sqlserver2008 using linq  ?

 



Jun 12, 2008 at 3:29 PM
Hi,

This post about using connection strings with LINQ to SQL might help, but you still haven't indicated if you're having any specific issues or what best means in your case.

Fernando



jayashree wrote:


fsimonazzi wrote:
Hi,

Can you elaborate on the kind of integration are you looking for? If you're using LINQ's syntax then you will not use EntLib's DB-agnostic API, and EntLib's implementation doesn't use LINQ. While you could use EntLib's database as a DbConnection creator to feed connections to a DataContext, it would be overkill and the ability to create connections for different ADO.NET providers would only get in the way.

Regards,
Fernando




jayashree wrote:
Hi, can any one suggest me how to connect sql 2008 to Asp.net 3.5 using LINQ from EntLib 4.0



Hi,

I am not sure of the EntLib's API, formely I hava used DatabaseFactory to connect sqlserver 2005, can I know what is the best way to connect sqlserver2008 using linq  ?

 






Jun 13, 2008 at 5:35 AM
I really dont know how to use Entlib to connect the sqlserver using LINQ, can I get any reference for that
Jun 13, 2008 at 4:19 PM
Hi,

There is no such reference AFAIK, but I doubt it there's much to describe. EntLib's DAAB sits on top of the raw ADO.NET API, and there are few contact points between LINQ to SQL and ADO.NET API-wise. You can supply a connection when you create a data context and that connection can come from EntLib, and you can get a DbCommand out of LINQ to SQL query so you could arguably execute it with EntLib (but I haven't tried that.)

Is there something you need to accomplish that requires both the DAAB and LINQ to SQL, or are you just exploring?

Fernando


jayashree wrote:
I really dont know how to use Entlib to connect the sqlserver using LINQ, can I get any reference for that


Aug 14, 2008 at 3:02 PM
RE: "Is there something you need to accomplish that requires both the DAAB and LINQ to SQL, or are you just exploring?"

I would like the ability to use the LINQ (IQueryable) syntax and model against any of the databases the DAAB supports. An Ent Lib "LINQ to whatever is in your configuration file". Does that make sense?
I think that would mean a LINQ provider on top of DAAB.
So something like:
Microsoft.Practices.EnterpriseLibrary.Data.Linq.DataContext myContext = new DataContext(namedInstance);
or 
Microsoft.Practices.EnterpriseLibrary.Data.Linq.DataContext myContext = new SqlDataContext(connString); (or OracleDataContext, or GenericDataContext)

Thanks,
Karl
Aug 15, 2008 at 1:25 PM
Hi Karl,

Thanks for your update.

I'm not sure how feasible such an implementation would be; I know that certain extensibility points in LINQ to SQL have been purposefully closed (see http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx), and coming up with a new IQueryable implementation from scratch might be overkill. However, it would be great if you could log a feature request describing the kind of support you'd like to see.

Regards,
Fernando