views:

69

answers:

1

I'm trying to figure out how to make the generated Linq to SQL classes be marked private instead of public, so that it is not visible outside the assembly. There doesn't seem to be a way to do this in the Visual Studio O/R designer or the SqlMetal tool, unless I'm missing something. Has anyone found a way to do this?

I'm asking because I'm using Linq to SQL internally as a data access layer in a business logic assembly. I am exposing to clients a separate set of custom entity classes, and I don't want the Linq to SQL classes to be exposed at all.

+4  A: 
veggerby
Great, I missed that. Also, it looks like I can do a CTRL-A to select all classes and then set the Access property on all of them at once (otherwise this solution would not have been practical due to number of classes).
DSO
This still exposes the generated data context class. I'll wait a bit and see if anyone has an even better approach that makes everything private... then I'll accept the best answer.
DSO
Note! I added "Same principles apply for the DataContext itself (just click in the "white area" of the designer) and change under Properties"
veggerby
Ah, thanks! I do wish the there was some project option in VS that would just generate private classes by default, but this is good enough.
DSO