I've see many users ask this question and to date I've yet to find a response that actually answers the question.
If I have an Entity validation rule that requires a trip to the database and also requires that it be part of any INSERT or UPDATE action on the entity how would this be implemented? I already force Validation of the Entity by listening to the EntityProviderBase.DataRequesting event and calling Validate() on the e.CurrentEntity (when it isn't null, which means INSERT, UPDATE, or DELETE is being called)
Please don't answer, "You should put it in a processor at the Service Layer .", as it is too easy for another developer down the road to work with this code and directly Save the entity via the DataRepository and by pass the processor and service layer all together thereby saving an entity with invalid state to the database.
Maybe this is just a tough question because it is not possible to do and the validation and it must truly lying the service layer.
Any ideas?
Thanks In Advance