Share via


Defining Calculated Properties

The value of a calculated property is determined by a method that you provide.

Calculated Property Example

The following example uses the sample model Library.dsl to define a calculated property called AmountOwed. You set the Kind property on a domain property to Calculated. Next, you add the partial class LibraryHasMembers to the project. You then provide the method GetAmountOwedValue, which determines the total amount that a member owes for overdue and lost books.

namespace ExampleNamespace
{
    public partial class LibraryHasMembers
    {
        private System.Single GetAmountOwedValue()
        {
            // Do calculation to get amount owed.
            return 0.0F;
        }
    }
}

See Also

Concepts

Library.Dsl Overview