I have defined this simple verefier for the entity Person, this verifier verifies that the city and
the state are correct, (the state is the state of the city), for example if the person is from Los Angeles,
California, the user must entry, California and Los Angeles, not Los Angeles and Florida. this verifer works fine
the problem comes when you try to get the Principal Identity in the Server Side in a EntityServerQueryInterceptor
, it is always empty when the petition is about a Person normal for the others Entities
, after a couple of days trying to find an error in my code, I discovered that the problem was that the verifier use navigation properties, when
I change the verifiers to use the ids instead of the properties, its work fine, but Vs2010 never comes with exception or something
List<Verifier> verifiers = new List<Verifier>();
var v1 = new DelegatePropertyValueVerifier<Person>("The city must be in the state", EntityPropertyNames.LocationCity, false,
(itemToVerify, valueToVerify, verifierContext) =>
{
var locationCity = valueToVerify as City;
var res = locationCity != null && !locationCity.EntityAspect.IsNullEntity && itemToVerify.LocationState != locationCity.State;
return new VerifierResult(!res);
});
verifiers.Add(v1);