/// <summary> /// Adds a new Event Launch Point to the pattern. /// </summary> /// <returns>Returns an <see cref="IEventSettings"/> for the added event.</returns> public static IEventSettings CreateEvent <T>(this IProductElement product, string name) { Guard.NotNull(() => product, product); var patternSchema = product.Info as IPatternElementSchema; var eventSettings = patternSchema.CreateAutomationSettings <IEventSettings>(name); eventSettings.EventId = typeof(T).ToString(); product.AddAutomationExtension(new EventAutomation(product, eventSettings)); return(eventSettings); }
/// <summary> /// Adds a new Command by specifying the command type. /// </summary> /// <returns>Returns an <see cref="ICommandSettings{T}"/> for the added command. May be chaineable.</returns> public static ICommandSettings <T> CreateCommand <T>(this IProductElement product, string name) { Guard.NotNull(() => product, product); var patternSchema = product.Info as IPatternElementSchema; var commandSettings = patternSchema.CreateAutomationSettings <ICommandSettings>(name); commandSettings.TypeId = typeof(T).ToString(); product.AddAutomationExtension(new CommandAutomation(product, commandSettings)); return(new CommandSettingsDelegator <T>(commandSettings)); }
public static GenerateProductCodeCommand CreateGenerateCodeCommand(this IProductElement element, IServiceProvider sp , string targetFileName , string targetPath , string templateUri , string namePrefix = "GenerateCode" , string buildAction = "Compile") { var command = CreateTempGenerateCodeCommand(element, sp, targetFileName, targetPath, templateUri, namePrefix, buildAction); var automation = new InnerCommandAutomation(command) { Name = namePrefix + command.Settings.Id.ToString(), Owner = element }; element.AddAutomationExtension(automation); return(command); }