none
Questions regarding using partial classes to extend entities RRS feed

  • Question

  • WHAT I HAVE:

    Visual Basic 2010, .NET Framework4.0, Entity Framework 4.0, SQL Express

    MY PROBLEM:

    I've been using partial classes to add additional (usually non-database-mapped) members to my entities. I have two questions regarding the use of partial classes with entities:

    1. Can I use the partial-class mechanism to Implement more interfaces for my entities--i.e., IComparer for sorting purposes?

    2. Can I use it to implement "property-level" validation--that is, to validate a (database-mapped) property when it's being set--as opposed to "record-level" validation, which is done when the .SaveChanges method is being called?


    Robert Gustafson



    Saturday, March 22, 2014 12:32 AM