[Mono-list] SqlMetal custom DataContext name

Abe Gillespie abe.gillespie at gmail.com
Tue Dec 7 08:43:48 EST 2010


You're talking about "DbMetal" right?

It sounds like the context name is provider-specific.  I use DbLinq
for Postgres and it does use the name of the database.  You might,
instead, try outputting a .dbml file first, edit it, and then use that
as your mapping file.  Unfortunately that means when your DB schema
changes you have to a) do that process each time, b) maintain the
.dbml file manually, or c) write a script that does those steps
automatically.

Lastly, there's a chance the mapping file won't even work.  DbMetal is
pretty limited in its functionality; case in point, I was unable to
get the /entitybase switch working.

Good luck.
-Abe

On Tue, Dec 7, 2010 at 6:00 AM, Daniel Hughes <trampster at gmail.com> wrote:
> I am using SqlMetal in ubuntu 10.10 to create code for connecting to
> an existing sqlite database.
>
> 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)
>
> In the Microsoft sqlmetal you use the /Context switch to specify a
> custom name, however on the mono one I can't find a switch which will
> do this. Also the microsoft one uses the database name as the
> DataContext default (which makes much more sense, and would be fine in
> my case)
>
> So how do I customize the DataContext name?
> _______________________________________________
> 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