marcodelpin / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
Other
0 stars 0 forks source link

Npgsql support broken (DbLinqProvider problem) #177

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use DbLinq with Npgsql

It seems that Npgsql capitalizes the connection string so that:
"DbLinqProvider=xxx" becomes "DBLINQPROVIDER". The regex does not match in
that case and SqlServer is used. Here is the fix in DataContext.cs:

Change:
private void GetVendorInfo(ref string connectionString, out Assembly
assembly, out string typeName)
        {
            System.Text.RegularExpressions.Regex reProvider
                = new
System.Text.RegularExpressions.Regex(@"DbLinqProvider=([\w\.]+);?");

for:
        private void GetVendorInfo(ref string connectionString, out
Assembly assembly, out string typeName)
        {
            System.Text.RegularExpressions.Regex reProvider
                = new
System.Text.RegularExpressions.Regex(@"DbLinqProvider=([\w\.]+);?", ,
System.Text.RegularExpressions.RegexOptions.IgnoreCase);

This fixes the problem. Thanks :)

Original issue reported on code.google.com by matthieu...@gmail.com on 14 Jan 2010 at 2:54

GoogleCodeExporter commented 9 years ago
Actually, with a recent Npgsql version, the DbLinqProvider is rejected 
altogether.
How can I use DbLinq with PostgreSQL?

Original comment by matthieu...@gmail.com on 14 Jan 2010 at 4:02

GoogleCodeExporter commented 9 years ago

Original comment by jonmpr...@gmail.com on 25 Jan 2010 at 10:39

GoogleCodeExporter commented 9 years ago
Update: I made it work simply by using another constructor of the 
DataContext... I
used MyContext (IDbConnection, IVendor) instead of simply (IDbConnection).

Original comment by matthieu...@gmail.com on 2 Feb 2010 at 2:36