title: Specification pattern:MultiType Composite Specifications
body: <p>I'm the need complex <strong>multi Type</strong> (<code>&lt;TLeft,TRight&gt;</code>) specifications Like:</p>
  
  <pre><code>public class AndSopecification&lt;TLeft,TRight&gt;
  {
  
      public AndSpecification(ISpecification&lt;TLeft&gt; leftSide, ISpecification&lt;TRight&gt; rightSide)
      {
      }
      .
      .
      .
  }
  </code></pre>
  
  <p>But all specification examples I see are implemented <strong>single type</strong> (<code>&lt;T&gt;</code>) like:</p>
  
  <pre><code>public sealed class AndSpecification&lt;T&gt; : CompositeSpecification&lt;T&gt;
  {
      public AndSpecification(ISpecification&lt;T&gt; leftSide, ISpecification&lt;T&gt; rightSide)
      {            
      }
      .
      .
      .
  }
  </code></pre>
  
  <p>Is there any problem if i create complex specifications like:</p>
  
  <pre><code>new AndSpecification&lt;Foo,Bar&gt;(new FooSpecification(),new BarSpecification()).SatisfiedBy();
  </code></pre>
  
  <p>So I can reuse all specifications inside each other for different situations then I can have single unique process points which can be composition units of more complex specification trees. </p>
  
  <p>But I cant find an implementation like that.</p>
  
  <p>Am I in a right road?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I'm translating every conditional sentence which customer uses, into a <code>specification</code> and reuse them everywhere the customer reuses the sentence </p>
  
  <p>(In every related <code>logic</code>,<code>query predicate</code>,<code>business rule validation</code> ,..., and I think these <code>specifications</code> are naturally the same in each of these situations)</p>
  
  <p>And as the customer do , I create <code>composite specifications</code> ,</p>
  
  <p>But I'm accessing them with different infrastructure in each one of situations(<code>query predicate</code>,<code>business rule validation</code> ,...)</p>