Accessing Extended Property From Template

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
PatConnelly
Posts: 18
Joined: Fri 17 Jun 2005 14:15

Accessing Extended Property From Template

Post by PatConnelly » Thu 31 Jul 2014 00:27

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Accessing Extended Property From Template

Post by MariiaI » Fri 01 Aug 2014 05:22

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.

Post Reply