Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > configured attribute T3 - no property on action
 

configured attribute T3 - no property on action

Hi,

In the guidance package template there is a sample recipe 'generaterepeatingclass' where a T3 action is used like this:
...
  <Action Name="GenerateClass" Type="Microsoft.Practices.RecipeFramework.Library.Actions.T3Action, Microsoft.Practices.RecipeFramework.Library"
                Template="T3\Repeating.cs.t3"
                InputValue="Configured Static Value">
          <!-- InputValue shows a configured attribute in T3 that doesn't need a property on the class -->
...

Could you explain to me why the 'InputValue' does not need a property on the class?

Moreover, how would you set the 'InputValue' in code like:
T3Action action = new T3Action();
action.Template = ...;
I tried to use action.Configure(...) but for to be succesfull a property on the class seems to be necessary?

thanks in advance,

Katrien
katrien  Tuesday, July 12, 2005 1:04 PM
T3 is a very special kind of action, in that it extends the type information by implementing ICustomTypeDescriptor. Without getting in too much detail, that means that it fakes additional properties, including all the inputs you pass with <Input> elements for the T3 template to use.

When GAT sets the inputs, it does so by using the TypeDescriptor.GetProperties method on the action. So if you want to set the value, you would do the following:

T3Action action = new T3Action();
TypeDescriptor.GetProperties(action)["InputValue"].SetValue(action, "MyValue");
kzu  Tuesday, July 12, 2005 8:54 PM
T3 is a very special kind of action, in that it extends the type information by implementing ICustomTypeDescriptor. Without getting in too much detail, that means that it fakes additional properties, including all the inputs you pass with <Input> elements for the T3 template to use.

When GAT sets the inputs, it does so by using the TypeDescriptor.GetProperties method on the action. So if you want to set the value, you would do the following:

T3Action action = new T3Action();
TypeDescriptor.GetProperties(action)["InputValue"].SetValue(action, "MyValue");
kzu  Tuesday, July 12, 2005 8:54 PM
This is very good info.  Unfortunately, when executing this code I get a 'NotSupportedException' because the dictionary is 'read-only'.  Could you give me some advice on this?

katrien  Wednesday, July 13, 2005 10:39 AM
Hi Katrien, were you able to solve this problem ? I am getting the same exception when I try to set the value and would like to know if there is any other way to solve this.
Sonnet  Friday, May 05, 2006 2:12 PM

You can use google to search for other answers

Custom Search

More Threads

• How to modify the SCSF Add View (with presenter) generated code
• VSTS 2008 - installed GAX but GAT fails: C# Language is not installed
• Using IAssetReferenceService
• System.Collections.Generic.KeyNotFoundException in custom T4 Action
• Change location solution is unfolded to
• Is there a simplified Guidance Package Development Package or...
• Starting VS2008 SP1 Beta1 In Experimental Hive Fails with Recipe Framework Error
• Not being shown the GAX screen to select '08
• Problems installing a Guidance Package
• Installing Visual Studio 2005 Service Pack 1 (XP edition) breaks GAT