Page 1 of 1

Accessing Extended Property From Template

Posted: Thu 31 Jul 2014 00:27
by PatConnelly
I have added an extended property to my model: IsIFinancialData and added the last if statement to the following block in the DbContext template:

Code: Select all

    if (cls.BaseInheritance == null) {
      if (ImplementINotifyPropertyChanging)
        baseList = string.IsNullOrEmpty(baseList) ? "INotifyPropertyChanging" : baseList + ", INotifyPropertyChanging";
      if (ImplementINotifyPropertyChanged)
        baseList = string.IsNullOrEmpty(baseList) ? "INotifyPropertyChanged" : baseList + ", INotifyPropertyChanged";
       if ((bool)cls.GetProperty("IsIFinancialData"))
         baseList = string.IsNullOrEmpty(baseList) ? "IFinancialData" : baseList + ", IFinancialData";
    }
When I try to build the template I get the following error:

Custom tool error: Unknown property: 'IsIFinancialData'.

To make sure I wasn't missing something spelling or upper/lower case, I copied/pasted from the properties dialog box. What am I missing?

Thanks!

Patrick Connelly

Re: Accessing Extended Property From Template

Posted: Fri 01 Aug 2014 05:22
by MariiaI
The developer can customize the set of properties of any element in the model by declaring extended properties in two ways:
a) in template code:

Code: Select all

<#@ extended name="IsIFinancialData" owner="Property" type="System.Boolean" default="false" #>
b) in Model Properties by right-clicking on diagram surface -> Edit Model Settings -> Model -> Extended Properties and adding the necessary extended property.

Have you defined your extended property in the template code? If the problem persists, please send us your template or model so that we are able to investigate the issue in more details.

Also, we recommend using the last build of Entity Developer 5.7.412: it includes fix "The bug with applying changes after editing the list of the extended properties via the Model Settings dialog is fixed".
Please refer to http://forums.devart.com/viewtopic.php?f=32&t=30069.