Hi again, I just ran DbMetal & got the following:
DbLinq Database mapping generator 2008 version 0.19 for Microsoft (R) .NET Framework version 3.5 Distributed under the MIT licence (http://linq.to/db/license) >>> Reading schema from DBML file 'DataClasses1.dbml' DbMetal failed:System.NullReferenceException: Object reference not set to an instance of an object. at DbMetal.Generator.Implementation.SchemaLoaderFactory.GetLoaderAndConnection (String& dbLinqSchemaLoaderType, String& databaseConnectionType, String provider) at DbMetal.Generator.Implementation.SchemaLoaderFactory.Load(String provider) at DbMetal.Generator.Implementation.Processor.ReadSchema(Parameters parameters, ISchemaLoader& schemaLoader) at DbMetal.Generator.Implementation.Processor.ProcessSchema (Parameters parameters) I would appreciate any help, TIA Joe On Jan 21, 4:19 pm, jbm417 <[email protected]> wrote: > 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- Hide quoted text - > > - Show quoted text - -- 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.
