views:

21

answers:

2

I have two tables, both named as say, Employee in two different schema HR and Production [i.e. dbo.HR.Employee and dbo.Production.Employee are my two database objects]. While dragging these two tables in LINQ to SQL design pane its generating two classes named Employee and Employee1. My ques: Is there any way I can create classes with Database schema name HR and Production in our case so that we can craete Employee class within that to replicate database schema?

A: 

Depending on how much the two schemas overlap, I would create two separate *.dbml's, separated by namespace. One would have MyApp.Entities.HumanResources.Employees. The other class would map to MyApp.Entities.Production.Employees.

If there's a lot of overlap in the two schemas, then this solution may not work very well for you. In that case, you'll have to rename the class in the designer (ex: HrEmployees and ProductionEmployees).

Jarrett Meyer
A: 

Yes, you can rename the classes in the designer to HREmployees and ProdEmployees (or whatever you want to call them)

KristoferA - Huagati.com