LINQ to SQL for Large Projects
- I'm beginning to wonder if L2S is suitable for large projects. By a large project I mean a database containing many tables spread across many schemas. We would like our entities contained in namespaces that match our database schema names. We have database parent / child relationships that span across schemas. This means our parent / child entities will span across namespaces. L2S isn't able to handle this. In L2S, I cannot model a relationship that involves a parent in one namespace (.DBML) and a child in another namespace (.DBML); at least not without having to write a fair amount of custom code. But this partially defeats the purpose of using L2S.
So, we could put all our entities in a single namespace, which we don't want to do. Or we could write custom code in partial entity class to overcome the modeling limitation. We don't particularly want to do this either.
How have others dealt with this?
Thanks.
Answers
- I don't know if this will be relevant but have you tried looking at the entity framework?
I don't know if linq to entities will solve this problem, just a suggestion, as L2S is more suited for rapid development and only sql server but entity framework is more scaled to larger projects as you stated!
Hope this helps!- Proposed As Answer byLingzhi SunMSFT, ModeratorMonday, November 09, 2009 12:32 AM
- Marked As Answer byLingzhi SunMSFT, ModeratorFriday, November 13, 2009 2:06 AM
- You could look at the LINQ to SQL templates on http://l2st4.codeplex.com - they let you customize the code generation process from the DBML so you could put custom logic in there to split out the namespaces.[)amien
- Proposed As Answer byLingzhi SunMSFT, ModeratorMonday, November 09, 2009 12:32 AM
- Marked As Answer byLingzhi SunMSFT, ModeratorFriday, November 13, 2009 2:06 AM
Hi Randy,
Currently, I think we need to manually set the association/relationships to resolve the problem, as Kristofer suggested in this related thread, http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/01212f12-e18d-47bf-ab87-ae4fbcfd1fe3.
Have a nice day!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed As Answer byLingzhi SunMSFT, ModeratorMonday, November 09, 2009 12:32 AM
- Marked As Answer byLingzhi SunMSFT, ModeratorFriday, November 13, 2009 2:06 AM
All Replies
- You could look at the LINQ to SQL templates on http://l2st4.codeplex.com - they let you customize the code generation process from the DBML so you could put custom logic in there to split out the namespaces.[)amien
- Proposed As Answer byLingzhi SunMSFT, ModeratorMonday, November 09, 2009 12:32 AM
- Marked As Answer byLingzhi SunMSFT, ModeratorFriday, November 13, 2009 2:06 AM
- Damien,
I think you may have misunderstood my problem. I'm already splitting out the namespaces. Each of our DBML's acts as a namespace. The problem is that L2S isn't able to model relationships across DBML's. I don't really want to have to write a lot of custom code to do this modeling. This is the problem I'm trying to solve.
Randy - I don't know if this will be relevant but have you tried looking at the entity framework?
I don't know if linq to entities will solve this problem, just a suggestion, as L2S is more suited for rapid development and only sql server but entity framework is more scaled to larger projects as you stated!
Hope this helps!- Proposed As Answer byLingzhi SunMSFT, ModeratorMonday, November 09, 2009 12:32 AM
- Marked As Answer byLingzhi SunMSFT, ModeratorFriday, November 13, 2009 2:06 AM
Hi Randy,
Currently, I think we need to manually set the association/relationships to resolve the problem, as Kristofer suggested in this related thread, http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/01212f12-e18d-47bf-ab87-ae4fbcfd1fe3.
Have a nice day!
Best Regards,
Lingzhi SunMSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Proposed As Answer byLingzhi SunMSFT, ModeratorMonday, November 09, 2009 12:32 AM
- Marked As Answer byLingzhi SunMSFT, ModeratorFriday, November 13, 2009 2:06 AM


