You can "register" a custom property with DevForce via the PropertyMetadata class and a new DataEntityProperty field, but it may be more work than you want for a simple calculated property. Registering a backing DataEntityProperty for a custom property looks something like this: public partial class Customer { public string FullName { get { return PropertyMetadata.FullName.GetValue(this); } } public new partial class EntityPropertyNames { public const string FullName = "FullName"; } public partial class PropertyMetadata { public static readonly DataEntityProperty<Customer, string> FullName = new DataEntityProperty<Customer, string>( propertyName: EntityPropertyNames.FullName, isNullable: false, isPartOfKey: false, concurrencyStrategy: ConcurrencyStrategy.None, isAutoIncrementing: false, relatedNavigationPropertyName: null, isNativeProperty: false); } } The problem is that once you've tied into the PropertyMetadata you won't be able to use a simple property getter like you're probably now using, but will need to do some sort of property interception. Something like this: [AfterGet(EntityPropertyNames.FullName)] public void FullNameGetInterceptor(PropertyInterceptorArgs<Customer, String> args) { args.Value = FirstName + LastName; }
If this all looks like more than you need, then simple reflection will also allow you to get and set your custom property from your entity base class.
|