Page 1 of 1

How to access Extended Properties in templates

Posted: Tue 08 Apr 2014 23:27
by billster6809
I have created a number of Class, Property and RelationProperty extended properties in my model. I used the "Model Settings" dialog to create them. I then used them throughout my model. I see that they are added in the .edps file.

Now I want to access them within the template to alter the code generation. I can't figure out how to access them.

Here is an example: I added a Class extended property called "UDF", of type boolean. I set it on entities which are intended to implement a particular interface, "IUserDefinedFields".

Next, in the template, (based on DbContext), I found the section which adds the base classes and interfaces, under a section if (cls.BaseInheritance == null).

In there, where in the cls EntityClass instance do I get at that UDF property?

The only example I find in the help file is for RelationProperties, defined within the template and not using the Model Settings.

I assume I will need a hint for how to access the Property and maybe RelationProperty entries as well.

Re: How to access Extended Properties in templates

Posted: Fri 11 Apr 2014 05:18
by MariiaI
You can access the extended properties in the template via the GetProperty method:

Code: Select all

<ObjectName>.GetProperty("<PropertyName>")
If you have any further questions, feel free to contact us.