src/Misc/EFTools/EntityDesign/VisualStudio/TextTemplating/TemplateActivity.cs
/// <summary>
///     Transforms a text template that is specified in the <see cref="TemplatePath" /> property by calling the Visual Studio STextTemplatingService.
/// </summary>
/// <param name="context">The state of the current activity.</param>
Transforms a text template that is specified in the  property by calling the Visual Studio STextTemplatingService.
Transforms a text template that is specified in the property by calling the Visual Studio STextTemplatingService .
protected override void Execute(NativeActivityContext context)
        {
            var templateInputs = new Dictionary<string, object>();
            var symbolResolver = context.GetExtension<SymbolResolver>();
            var edmParameterBag = symbolResolver[typeof(EdmParameterBag).Name] as EdmParameterBag;
            if (edmParameterBag == null)
            {
                throw new InvalidOperationException(Resources.DatabaseCreation_ErrorNoEdmParameterBag);
            }
            _edmxPath = edmParameterBag.GetParameter<string>(EdmParameterBag.ParameterName.EdmxPath);
            if (_edmxPath != null)
            {
                templateInputs.Add(EdmParameterBag.ParameterName.EdmxPath.ToString(), _edmxPath);
            }
            OnGetTemplateInputs(context, templateInputs);
            var unresolvedTemplatePath = TemplatePath.Get(context);
            if (String.IsNullOrEmpty(unresolvedTemplatePath))
            {
                throw new InvalidOperationException(
                    String.Format(CultureInfo.CurrentCulture, Resources.DatabaseCreation_ErrorTemplatePathNotSet, DisplayName));
            }
            foreach (var inputName in templateInputs.Keys)
            {
                CallContext.LogicalSetData(inputName, templateInputs[inputName]);
            }
            try
            {
                TemplateOutput = ProcessTemplate(unresolvedTemplatePath);
            }
            finally
            {
                foreach (var inputName in templateInputs.Keys)
                {
                    CallContext.FreeNamedDataSlot(inputName);
                }
            }
        }
protected override void Execute ( NativeActivityContext context ) { var templateInputs = new Dictionary < string , object > ( ) ; var symbolResolver = context . GetExtension < SymbolResolver > ( ) ; var edmParameterBag = symbolResolver [ typeof ( EdmParameterBag ) . Name ] as EdmParameterBag ; if ( edmParameterBag == null ) { throw new InvalidOperationException ( Resources . DatabaseCreation_ErrorNoEdmParameterBag ) ; } _edmxPath = edmParameterBag . GetParameter < string > ( EdmParameterBag . ParameterName . EdmxPath ) ; if ( _edmxPath != null ) { templateInputs . Add ( EdmParameterBag . ParameterName . EdmxPath . ToString ( ) , _edmxPath ) ; } OnGetTemplateInputs ( context , templateInputs ) ; var unresolvedTemplatePath = TemplatePath . Get ( context ) ; if ( String . IsNullOrEmpty ( unresolvedTemplatePath ) ) { throw new InvalidOperationException ( String . Format ( CultureInfo . CurrentCulture , Resources . DatabaseCreation_ErrorTemplatePathNotSet , DisplayName ) ) ; } foreach ( var inputName in templateInputs . Keys ) { CallContext . LogicalSetData ( inputName , templateInputs [ inputName ] ) ; } try { TemplateOutput = ProcessTemplate ( unresolvedTemplatePath ) ; } finally { foreach ( var inputName in templateInputs . Keys ) { CallContext . FreeNamedDataSlot ( inputName ) ; } } }
Transforms a text template that is specified in the  property by calling the Visual Studio STextTemplatingService.
Transforms a text template that is specified in the property by calling the Visual Studio STextTemplatingService .
// Add the EDMX path as a template input if it was populated as a parameter to the workflow // Call OnGetTemplateInputs, which will ask any derived class for inputs they would like the // templates to have access to // Retrieve the template name specified on the workflow file // Add the template inputs to CallContext // We have to make sure we clear the CallContext data slots we set
context
NativeActivityContext
The state of the current activity.
The state of the current activity .