I posted incorrect information earlier. This post has now been corrected and the thread has been cleaned up to avoid confusion.
1) Verification will not automatically fire on a POCO object because the verification engine has no way to know when a property has been set in a generic object. Thus, you will need to call it explicitly when you want it triggered (as you've done, although obviously the code could be refactored into a method).
However, if you want verification for a custom property (e.g. a non-database property) on a DevForce Entity, you can have it automcatically triggered by adding hooks to support DevForce's property interceptors.
To support DevForce's property interceptors (which are useful for many things besides verification), you should define your properties like below. This will enable the VerifierEngine to be notified when the property changes.
[Attributes removed for clarity]
public String ShoeSize {
get { return ShoeSizeEntityProperty.GetValue(this); }
set { ShoeSizeEntityProperty.SetValue(this, value); }
}
Then you will need to define a static variable for each property (in this case ShoeSizeEntityProperty) that returns a DataEntityProperty that describes the property.
// Note the final false indicating that this is not a datastore-backed property!
public static readonly DataEntityProperty<Employee, String> ShoeSizeEntityProperty =
new DataEntityProperty<Employee, String>("ShoeSize", false, false, ConcurrencyStrategy.None, false,
VerificationSetterOptions.Both, false);
You can see more examples of this in our generated code. Note that the final parameter will differ from the generated code as it indicates that the property is not backed by the database.
After you invest the time to add the property interceptor hooks to your class, you'll be able to use the VerifierEngine and Property Interceptors on your custom properties the same way they work on the DevForce generated properties.
2) On the designer screen for the resource, there is an 'Access Modifier' drop down which you can change from 'internal' to 'public'. If that is not sufficient, you may need to go into the designer.cs file for the resource and change some of the properties to public as well.
Edited by ting - 24-Mar-2010 at 5:34pm