I have built a data driven model by dragging my tables onto the empty designer of an edml. I know that I can establish a datacontext around my model, and that I can access each table as though it were a class, but where is the code for each of these models?
I ask because I want to add validation to the setters of each property on the class itself.
Look for a
.dbmlfile on the root level of your project. Under that file, you will see a file called<someDB>.designer.cs.However, (and you’ll see this at the top of the designer file as well), you don’t really want to make any changes to the classes in this file.
If you want to make additions, you should look into creating
Partialclasses that extend the functionality of the generated classes.Here is a sample partial class that I created to handle my validations:
NOTE Your partial class must be defined in the same namespace that you see at the top of your
designer.csfile.