I hit the same error in Mono 2.10, which I am using because it’s marked stable in my distro. The sqlmetal shipped with mono seems useless. It assumes that you want to specify parameters for connecting to the database:
ohnobinki@gentoodcxdelllappy /tmp $ sqlmetal --debug test.dbml > DbLinq Database mapping generator 2008 version 0.20 > for Microsoft (R) .NET Framework version 3.5 > Distributed under the MIT licence (http://linq.to/db/license) > > >>> Reading schema from DBML file 'test.dbml' > LoaderFactory.Load(schemaType=SqlServerSchemaLoader, > dbConnType=SqlConnection) > Failed on Activator.CreateInstance(SqlConnection) > LoaderFactory.Load() failed: Object reference not set to an instance of an > object > sqlmetal: System.NullReferenceException: Object reference not set to an > instance of an object > at DbLinq.SqlServer.SqlServerVendor.AppendServer > (System.Text.StringBuilder connectionString, System.String host) [0x00000] > in <filename unknown>:0 > at DbLinq.Vendor.Implementation.Vendor.BuildConnectionString > (System.String host, System.String databaseName, System.String userName, > System.String password) [0x00000] in <filename unknown>:0 > at DbMetal.Generator.Implementation.SchemaLoaderFactory.Load > (DbMetal.Parameters parameters, System.Type dbLinqSchemaLoaderType, > System.Type databaseConnectionType, System.Type sqlDialectType) [0x00000] > in <filename unknown>:0 > ohnobinki@gentoodcxdelllappy /tmp $ > You can trick it out of this, make BuildConnectionString() happy, by just specifying -s:junk, like: ohnobinki@gentoodcxdelllappy /tmp $ sqlmetal --debug -s:junk test.dbml > DbLinq Database mapping generator 2008 version 0.20 > for Microsoft (R) .NET Framework version 3.5 > Distributed under the MIT licence (http://linq.to/db/license) > > >>> Reading schema from DBML file 'test.dbml' > sqlmetal: System.InvalidOperationException: Operation is not valid due to > the current state of the object > at System.Linq.Enumerable.Single[Column] (IEnumerable`1 source, > System.Func`2 predicate, Fallback fallback) [0x00000] in <filename > unknown>:0 > at System.Linq.Enumerable.Single[Column] (IEnumerable`1 source, > System.Func`2 predicate) [0x00000] in <filename unknown>:0 > at DbMetal.Generator.Implementation.Processor.ValidateAssociations > (DbLinq.Schema.Dbml.Database database, DbLinq.Schema.Dbml.Table table) > [0x00000] in <filename unknown>:0 > at DbMetal.Generator.Implementation.Processor.SchemaIsValid > (DbLinq.Schema.Dbml.Database database) [0x00000] in <filename unknown>:0 > at DbMetal.Generator.Implementation.Processor.ProcessSchema > (DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0 > ohnobinki@gentoodcxdelllappy /tmp $ > and then you end up with the error that everyone here seems stuck at. If I’m at fault, it’d be awesome to know what I need to fix in my use of sqlmetal ;-). -- binki On Monday, June 25, 2012 4:19:13 PM UTC-4, [email protected] wrote: > > Just an update that the problems I describe below still exist in the Mono > 2.11 release. > > Sandro > > On Wednesday, 27 October 2010 10:20:54 UTC-4, Sandro wrote: >> >> I upgraded to Mono 2.8, and tried to use sqlmetal (see [1] for prior >> attempts). Mono still requires the SQL Server Browser service to be >> running, otherwise it can't resolve instance names (unlike MS.NET). >> >> In any case, sqlmetal chugs along then hits an >> InvalidOperationException: >> >> >>> Reading schema from SqlServer database >> sqlmetal: System.InvalidOperationException: Operation is not valid due >> to the current state of the object >> at System.Linq.Enumerable.Single[Association] (IEnumerable`1 source, >> System.Func`2 predicate, Fallback fallback) [0x00000] in <filename >> unknown>:0 >> at System.Linq.Enumerable.Single[Association] (IEnumerable`1 source, >> System.Func`2 predicate) [0x00000] in <filename unknown>:0 >> at DbMetal.Generator.Implementation.Processor.ValidateAssociations >> (DbLinq.Schema.Dbml.Database database, DbLinq.Schema.Dbml.Table table) >> [0x00000] in <filename unknown>:0 >> at DbMetal.Generator.Implementation.Processor.SchemaIsV >> id (DbLinq.Schema.Dbml.Database database) [0x00000] in <filename >> unknown>:0 >> at DbMetal.Generator.Implementation.Processor.ProcessSchema >> (DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0 >> >> >> Any thoughts? >> >> Sandro >> >> [1] >> http://groups.google.com/group/dblinq/browse_thread/thread/afc31ecc3463d8f2/ea6a43d40d49217a?lnk=gst#ea6a43d40d49217a > > -- You received this message because you are subscribed to the Google Groups "DbLinq" group. To view this discussion on the web visit https://groups.google.com/d/msg/dblinq/-/K6ArldACh5gJ. 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.
