[Mono-list] Using a mysql Set column with sqlmetal

Abe Gillespie abe.gillespie at gmail.com
Tue May 8 18:05:29 UTC 2012

All I can say is "GOOD LUCK!"  DbLinq has long atrophied and after
spending many many hours trying to wrangle it myself, I ended just
buying Devart.  Trust me, it pays for itself over the hours (and hours
and hours) of frustration it'll save.  I would recommend Devart or an
alternative method for accessing your data and to steer far clear of

Don't get me wrong, though.  It was a very ambitious project and the
code is quite beautiful.  But there are way too many edge cases that
aren't covered and you'll undoubtedly eventually run into one or more
of those issues.


On Tue, May 8, 2012 at 11:24 AM, Mathias Tausig
<mathias.tausig at a-cert.at> wrote:
> Hy!
> I am trying to use a mysql database with mono and Linq2Sql.
> After a long hassle I have actually managed to create a helper class
> with sqlmetal and use for certain databased.
> My problem starts, as soon as I try to use a table which has a column
> with a SET type in mysql.
> The dbml created by sqlmetal than has a line like this:
>      <Column Name="123_UNS" Member="_123UNS" Storage="_123uns"
> Type="enum J, N" DbType="set('J','N')" IsPrimaryKey="false"
> IsDbGenerated="false" CanBeNull="true" />
> And when I try to generate a C# class from it I get:
>>>> Reading schema from DBML file '/tmp/a3.dbml'
> <<< writing C# classes in file '/tmp/db.cs'
> sqlmetal: System.NullReferenceException: Object reference not set to an
> instance of an object
>  at DbMetal.Generator.CodeDomGenerator.GenerateTableClass
> (DbLinq.Schema.Dbml.Table table, DbLinq.Schema.Dbml.Database database)
> [0x00000] in <filename unknown>:0
>  at DbMetal.Generator.CodeDomGenerator.GenerateCodeDomModel
> (DbLinq.Schema.Dbml.Database database) [0x00000] in <filename unknown>:0
>  at DbMetal.Generator.CodeDomGenerator.Write (System.IO.TextWriter
> textWriter, DbLinq.Schema.Dbml.Database dbSchema,
> DbMetal.Generator.GenerationContext context) [0x00000] in <filename
> unknown>:0
>  at DbMetal.Generator.Implementation.Processor.GenerateCode
> (DbMetal.Parameters parameters, DbLinq.Schema.Dbml.Database dbSchema,
> ISchemaLoader schemaLoader, System.String filename) [0x00000] in
> <filename unknown>:0
>  at DbMetal.Generator.Implementation.Processor.WriteSchema
> (DbLinq.Schema.Dbml.Database dbSchema, ISchemaLoader schemaLoader,
> DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0
>  at DbMetal.Generator.Implementation.Processor.ProcessSchema
> (DbMetal.Parameters parameters) [0x00000] in <filename unknown>:0
> I have dug into the source code a bit, and I think, that at one point,
> Type.GetType("enum J, N") is executed and returns null.
> Is there some known possibility to make this work?
> regards
> Mathias
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list