Hi midnit;
Now, let me attempt and answer your specific questions, as well as give some suggestions. Please keep in mind that my suggestions might not be the best way for your application but I hope it should get you thinking and started.
I am wanting to a simple way to indicate the entity should undergo the "LockedMonthVerification" check - as in perhaps it either implements an interface or perhaps through your MetadataType attribute? |
Once you've read our Verifier write up, you'll notice that to use DevForce Verification, we advice you to do the following steps:
1. Create a class that implements an IVerifierProvider.
2. Implements the GetVerifiers method that returns IEnumerable<Verifier>.
2. Create your Verifier(s) and add that to a list of Verifiers and return the list.
To indicate whether an entity should undergo a Verifier check, you have to add a trigger to the Verifier. A trigger ultimately consists of an entity type and the entity's property. This is where a Verifier knows when to be invoked. Again, you can read this in more detail in our write up.
I presume the verifier has to query for the locked months for each entity marked as needing that type of verification - assuming they don't have override permission. Can this be done once per call to SaveChangesAsync, or must it be done for every entity?
|
The query can be done once per call to SaveChangesAsync on the SaveInterceptor.
Since you're doing SL, one suggestion that I have is to override the ValidateSave method on the SaveInterceptor. Inside that method, before you're calling base.ValidateSave, you can query your "locked" months synchronously on the server into the server-side EntityManager. That server-side EntityManager, in turn, can be accessible through the entity you're verifying inside your Verifier and you can retrieve your "locked" months there.
I have attached a code sample/pseudocode here (You can rename it to .cs). Hopefully it can get you started.