I’m working with system using Linq-2-SQL as its data layer, but which uses stored procedures to do the actual CRUD operations – the stored procs are configured against the CRUD methods for the data class in the model designer.
These are all working just fine.
Now we want to use partial classes to extend the functionality of our data classes to apply validation, and hold parsed versions of some of the database properties.
However when I create a partial class for one of the data classes, the datacontext stops using the methods configured against the dataclass and defaults to its own operations. This happens even if the partial is empty other than the just the class declaration.
I would guess that this might be because the method signature for the insert method stops tying up to what the datacontext is looking for, but I can’t see any overrides available to help fix it.
Is there a way around this so that I can use Partials and Stored Procs on the same data context?
Hooray – can answer my own question:
The problem is that the class name in the partial is case sensitive:
Our db table is lower case, therefore the class generated is lower case.
The Partial had been declare with proper case. Changing this to lower case fixed the problem!
Nice.