Extending LINQ classes to my own partial classes in different namespaces?

Posted by sah302 on Stack Overflow See other posts from Stack Overflow or by sah302
Published on 2010-04-06T21:55:45Z Indexed on 2010/04/06 22:33 UTC
Read the original article Hit count: 271

I have a .dbml file which of course contains the auto-generated classes based on my tables.

I would however, like to extend them to my own classes. Typically I design such that each of my tables get their own namespace in their own folder containing all of their associated dao and service classes. So if I am dealing with a page that only has to do with 'customers' for instance, I can only include the customerNS.

But when using LINQ I seem to be unable to do this. I have tried removing a default namespace from the project, I have tried putting the .dbml file into it's own folder with a custom namespace and then adding a 'using' statement, but no nothing works.

I also saw the Entity Namespace, Context Namespace, and Custom Tool Namespace properties associated with the .dbml file and tried setting all these to names x and trying 'using x' in my other class to allow me to extend partial classes, but it just doesn't work.

Is this possible or do I have to keep all extended partial classes in the same namespace as the .dbml file?

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about Extensibility