views:

53

answers:

1

The MSDN Library documentation for the RequiresProvidesDirectiveProcessor class in the Microsoft.VisualStudio.TextTemplating namespace refers to a design pattern called "requires/provides". What is this design pattern?

"The abstract base class for a directive processor that defines and implements a design pattern called requires/provides." - from MSDN Library

A: 

The custom directive implementing this pattern looks like this:

<#@ Custom processor="CustomDirectiveProcessor" 
    requires="name=value;name=value" 
    provides="name=value;name=value"  #>

It allows you to package multiple parameters instide of two standard - requires and provides. This pattern is used in directive processors generated by DSL toolkit.

Personally, I haven't found it to be particularly useful. When building a custom directive processor, I think it is clearer to separate each parameter. The amount of effort it takes is the same.

Oleg Sych