0

SqlMetal is creating object names such as...

The View:

Sales.ProductDescription

is created as:

Sales_ProductDescription

Ideally SqlMetal would create the ProductDescription class under a namespace .Sales. but thats probably too much to ask for. So is there anyways to get it to create the class without the sheme prefix such as "ProductDescription".

Thanks,
Justin

Justin
  • 10,667
  • 15
  • 58
  • 79

2 Answers2

1

This would involve some modifications to the DBML file after it's been generated. However, in terms of maintainability that might restrict your ability to quickly regenerate when the schema changes.

If you have a volatile schema you could check out this collection of powershell scripts I wrote some time ago that will handle such changes to the DBML. It takes an XML file as input. Warning: the sample in the code repository may be out of date, but the scripts certainly work - I still use them.

Reddog
  • 15,219
  • 3
  • 51
  • 63
  • You could also use those scripts to split your model into a few separate namespaces if you want including only a few limited linkages between the models - though my mileage in persisting the multiple models with shared entities was limited. – Reddog Apr 19 '11 at 19:56
0

SqlMetal has an optional parameter to include a namespace. The default value is no namespace. Check out this link on MSDN.

http://msdn.microsoft.com/en-us/library/bb386987.aspx

William Xifaras
  • 5,212
  • 2
  • 19
  • 21
  • I already use the namespace parameter. The question is how do I exclude the Scheme name from the class name and setting the namespace parameter has no effect on it. – Justin Apr 19 '11 at 20:24
  • I see. Unfortunately, I believe this is the designed behavior for SqlMetal.Dbo is the only schema that is ignored. You could change the schema for that view to dbo. – William Xifaras Apr 19 '11 at 20:28