我正在嘗試使用新的Mono 2.6 SqlMetal工具爲簡單的Sqlite數據庫創建DBML文件。該模式是非常簡單的如下:SqlMetal無法從Sqlite數據庫創建DBML
CREATE TABLE Tags (
Id INTEGER PRIMARY KEY,
TagName TEXT,
Description TEXT);
CREATE TABLE Trends (
TagId INTEGER NOT NULL,
Timestamp DATETIME NOT NULL,
Value TEXT,
PRIMARY KEY (tagid, timestamp));
我嘗試使用以下命令來創建DBML文件:
sqlmetal.exe /conn:"Data Source=MyDatabase.db" /namespace:MyNamespace /provider:Sqlite /dbml:MyDatabase.dbml
我得到以下輸出:
>>> Reading schema from SQLite database
<<< Writing file 'MyDatabase.dbml'
sqlmetal failed:System.InvalidOperationException: There was an error reflecting type 'DbLinq.Schema.Dbml.Database'. --->
System.InvalidOperationException: DbLinq.Schema.Dbml.Database is inaccessible due to its protection level. Only public types can be processed
at System.Xml.Serialization.ReflectionHelper.CheckSerializableType (System.Type type, Boolean allowPrivateConstructors) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer..ctor (System.Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, System.Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) [0x00000] in <filename unknown>:0 at System.Xml.Serialization.XmlSerializer..ctor (System.Type type) [0x00000] in <filename unknown>:0
at DbLinq.Schema.Dbml.DbmlSerializer.Write (System.IO.Stream xmlStream, DbLinq.Schema.Dbml.Database dbml) [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
我可以使用用於創建C#代碼文件的/ code選項,但在生成DBML時總是失敗。
我是否缺少一個微妙的命令行選項,或者是SqlMetal的這個新版本不適用於Sqlite?