To my understanding, an essential problem with related to this
fileOrServerOrConnection is that it could be either a filename,
server name or a connection string. Hence, this string is not
always valid connectionString for SqlConnection.
And not all database engines support constructing database
connection by a filename (even SQL Server 2000 does not).
(And as Pascal explained, this connection string has to identify
the target DBMS.)
To implement support for this mere string, those complexities
has to be solved.
Atsushi Eno
In entity framework you need to add an entry to machine.config in the
<DbProviderFactories> section.
For PostgreSQL It should look like this:
<add name="Npgsql Data Provider" invariant="Npgsql" description=".Net
Framework Data Provider for PostgreSQL Server" type="Npgsql.NpgsqlFactory,
Npgsql,
Version=1.99.2.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"/>
Sample edmgen (dbmetal/sqlmetal analoque) to generate the model files:
edmgen.exe /provider:Npgsql /mode:fullgeneration
/connectionstring:"postgresql
connection string" /project:ProjectNamespace
Maybe it is possible to use ADO .NET dataprovider factory as shown above.
Andrus.
If I want to create a DataContext given a connection string (the worst case), how do I know, when I type"new DataContext("database=mydb")"which DbLinq vendor should be used internally (I assume several vendors are already registered, which is not a problem).Even my solution (exposed a few messages ago), can not solve it in an unique way. What if two vendors can handle a given connection string?
Or define custom configuration sections for DBLinq itself to determine
preferred vendor types in order.
An alternative solution is to create a static class to define
the preferred order of vendors (something like
DBLinqConfiguration.PreferredVendors). It could be combined
with configuration settings, and it won't suck for those who
don't like configuration settings.
Though I have to say I do not love my idea. It is sort of hack ;)
Atsushi Eno
Pascal Craponne wrote:
> This is not a tool problem, this is an API problem:
>
> If I want to create a DataContext given a connection string (the worst
> case), how do I know, when I type
> "new DataContext("database=mydb")"
> which DbLinq vendor should be used internally (I assume several vendors
> are already registered, which is not a problem).
>
> Even my solution (exposed a few messages ago), can not solve it in an
> unique way. What if two vendors can handle a given connection string?
>
> On Tue, Oct 7, 2008 at 10:13, Andrus <kobru...@hot.ee
> <mailto:kobru...@hot.ee>> wrote:
>
>
>
> > A better idea, someone?
>
> In entity framework you need to add an entry to machine.config in the
> <DbProviderFactories> section.
>
> For PostgreSQL It should look like this:
>
> <add name="Npgsql Data Provider" invariant="Npgsql"
> description=".Net
> Framework Data Provider for PostgreSQL Server"
> type="Npgsql.NpgsqlFactory,
> Npgsql,
> Version=1.99.2.0 <http://1.99.2.0>, Culture=neutral,
> PublicKeyToken=5d8b90d52f46fda7"/>
>
> Sample edmgen (dbmetal/sqlmetal analoque) to generate the model files:
>
> edmgen.exe /provider:Npgsql /mode:fullgeneration
> /connectionstring:"postgresql
> connection string" /project:ProjectNamespace
>
> Maybe it is possible to use ADO .NET dataprovider factory as shown
> above.
>
> Andrus.
>
>
>
>
>
>
> --
> Pascal.
>
> jabber/gtalk: pas...@jabber.fr <mailto:pas...@jabber.fr>
> msn: pas...@craponne.org <mailto:pas...@craponne.org>
>
>
> >
Pascal Craponne wrote:
> So, here are the options:
> 1. We can use an additional identifier in the connection string (I love
> this idea). Can this work with Mono requirements?
Yes. I love the idea too :)
Atsushi Eno