开发者

LINQtoSQL: What is the Map File for?

开发者 https://www.devze.com 2023-02-05 19:07 出处:网络
I am currently using SqlMetal to generate my dbml and code file. I am using Visual Studio 2010 and SqlServer 2000. Unfortunately Visual Studio 2010 only support SqlServer 2005 or greater so I am unabl

I am currently using SqlMetal to generate my dbml and code file. I am using Visual Studio 2010 and SqlServer 2000. Unfortunately Visual Studio 2010 only support SqlServer 2005 or greater so I am unable to generate the code using the built-in wizard.

I have been generating my dbml and code files by using:

>sqlmetal /server:myServer /database:myDatabase /dbml:myDatabase.dbml
>sqlmetal /code:myDatabase.cs myDatabase.dbml

I have noticed there is a map file option.

Generates an XML mapping file instead of attributes. Cannot be used with /dbml option.

MSDN on SqlMetal.exe

I was wondering if I should also be using a map file? What is the advantag开发者_StackOverflow中文版es to a map file over code attributes?


See: http://msdn.microsoft.com/en-us/library/bb386907.aspx (mapping) See: http://msdn.microsoft.com/en-us/library/bb386971.aspx (attributes)

Bascially you can use an external mapping file (POX) instead of the dbml which is supposed to keep the mapping code separate from your application code.

I would use the DBML unless you plan on needing to be able to change mapping without recompilation or you need to have exact control over the mapping (maybe for odd custom stuff). Map file won't change. dbml might (removing any custom changes you may have made).

0

精彩评论

暂无评论...
验证码 换一张
取 消