On Dec 7, 2010, at 6:00 AM, Daniel Hughes wrote:
> By default the generated DataContext class name is Main.
>
> This causes problems for obvious reasons (really, I couldn't think of
> a default more likely to conflict)
What obvious reasons? Type names don't conflict with method names (unless the
method is in the same type, and I doubt you're going to make the Main type your
program entrypoint).
That said, the '-d DATABASE' option is also used to generate the DataContext
type. For example, if importing a SQLite database:
sqlmetal -d MyDb -provider:Sqlite /c "Data Source=foo.db3" /code:Foo.cs
The DataContext subclass is named 'MyDb' instead of the type 'Main'.
An alternate approach is to use /dbml to generate a .dbml file, then you can
edit the .dbml file and re-generate the source:
$ sqlmetal -provider:Sqlite /c "Data Source=foo.db3" /dbml:Foo.dbml
# edit Foo.dbml, changing the /Database/@Class attribute value
$ sqlmetal /code:Foo2.cs Foo.dbml
Unfortunately, this appears to require mono/master to work; using mono 2.8.1's
sqlmetal results in a NRE.
- Jon
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list