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

Mathias Tausig mathias.tausig at a-cert.at
Tue May 8 15:24:38 UTC 2012


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
  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?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5079 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120508/71ac70e9/attachment.bin>

More information about the Mono-list mailing list