Hi Jon,

The default constructor  private DataClasses1DataContext db_b = new
DataClasses1DataContext();
works because DataClasses1 inherits a connection string - see below.
In fact the whole DataClasses1
dbml was auto generated using O/R Designer which put the connection
string into Settings.settings.

public DataClasses1DataContext() : base
(global::Tabs.Properties.Settings.Default.shootingConnectionString1,
mappingSource)

I think I should run DbMetal with the command line you provided.
Perhaps the generated c# will answer
my questions, but if not, I will ask again.

Thanks for you reply,  Joe


On Jan 21, 2:56 pm, Jonathan Pryor <[email protected]> wrote:
> Inline...
>
>
>
> On Thu, 2010-01-21 at 09:12 -0800, jbm417 wrote:
> > I am converting a SqlServer application to use an embedded FireBird
> > db. The original app uses linq which I would like to continue using.
> ...
> > Have DbLinq in the VS 2008 c# based app but do not understand how to
> > create a datacontext.
>
> In theory, the same way you create a DataContext with Linq-to-SQL.
>
> > For example:
>
> >   the original app has:
>
> >            private DataClasses1DataContext db_b = new
> > DataClasses1DataContext();
>
> How is the default constructor working?  Don't you need a connection
> string or something?.
>
> > In the new app, using DbLinq, I am able to write:
>
> >          bConn = new FbConnection(ConStr);
> >          FirebirdDataContext fdb = new FirebirdDataContext(bConn);
>
> >          However, I cannot figure out where to go from here.
>
> > Questions:
>
> >  1. Can the DataClasses1 dbml be used or must I generate new dbml
> > using DbMetal?
> >      Database structure, col names & types, are the same in both
> > SqlServer & Firebird.
>
> This command should work:
>
>         DbMetal /provider:Firebird /code:Entities.cs DataClasses1.dbml
>
> This should create Entities.cs.  If it doesn't, please let us know the
> error that you see.
>
> >  2. If new dbml is required, will a simple datacontext change in the
> > query be sufficient?
>
> I don't understand this question.
>
> > Bottom line -- at the moment, I do not understand how
>
> > FirebirdDataContext fdb = new FirebirdDataContext(bConn);
>
> > provides any dbml association so that the query can find the geos
> > table info.
>
> Short answer: it doesn't, not directly.
>
> The above DbMetal command will generate C# source code containing
> entities based on the tables & columns from your .dbml file (just
> as .NET SqlMetal does), and these generated types will provide the
> information required to find the geos table info.
>
>  - Jon

-- 
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en.

Reply via email to