title: unity xml configuration generic interfaces
body: <p>I'm using Unity for constructor injection. Constructor injection via the runtime API succeeds with the following code:</p>
  
  <pre><code>{
  using ContractImplementations;
  using Contracts;
  using DataAccess;
  using DataModel.Entities;
  using DataModel.Interfaces;
  
  using Microsoft.Practices.Unity;
  
  using Unity.Wcf;
  
  /// &lt;summary&gt;
  /// The wcf service factory.
  /// &lt;/summary&gt;
  public class WcfServiceFactory : UnityServiceHostFactory
  {
      #region Methods
      /// &lt;summary&gt;
      /// Configure container.
      /// &lt;/summary&gt;
      /// &lt;param name="container"&gt;
      /// The container.
      /// &lt;/param&gt;
      protected override void ConfigureContainer(IUnityContainer container)
      {
          container
             .RegisterType&lt;IGaugeModelbaseService, GaugeModelbaseService&gt;()
             .RegisterType&lt;IContractMapper, ContractMapper&gt;(new HierarchicalLifetimeManager())
             .RegisterType&lt;IGenericRepository&lt;GaugeModel&gt;, GenericSqlRepository&lt;GaugeModel&gt;&gt;(new HierarchicalLifetimeManager());
      }
  
      #endregion
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Because of integration with AppFabric and  EntLib however I have to configure the container in XML config. Problem: The unity documentation is not clear on the subject of registering generic types. According to the documentation, I have to do something like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p>
    
      
    
    
      </p>
  
  <pre><code>&lt;namespace name="Design.ModelbaseSvc" /&gt;
  &lt;assembly name="Design.ModelbaseSvc" /&gt;
  &lt;namespace name="Design.ContractImplementations" /&gt;
  &lt;assembly name="Design.ContractImplementations" /&gt;
  &lt;namespace name="Design.DataModel" /&gt;
  &lt;assembly name="Design.DataModel" /&gt;
  &lt;namespace name="Design.DataAccess" /&gt;
  &lt;assembly name="Design.DataAcces" /&gt;
  
  
  &lt;container&gt;
    &lt;register type="IGaugeModelbaseService" mapTo="GaugeModelbaseService"&gt;
      &lt;interceptor type="InterfaceInterceptor" /&gt;
    &lt;/register&gt;
    &lt;register type="IContractMapper" mapTo="ContractMapper"&gt;
      &lt;lifetime type="hierarchical" /&gt;
    &lt;/register&gt;
    &lt;register type="IGenericRepository'1[Design.DataModel.Entities.GaugeModel, Design.DataModel]" mapTo="GenericSqlRepository'1[Design.DataModel.Entities.GaugeModel, Design.DataModel]"&gt;       
      &lt;lifetime type="hierarchical" /&gt;
    &lt;/register&gt;
  &lt;/container&gt;
  </code></pre>
  
  <p></p>
  
  <p>I don't understand what I'm doing wrong, but this doesn't work:
  - the XML-editor gives errors on using parenthesis "[]"
  - Browsing the svc-file give the folowing error:</p>
  
  <blockquote>
    <p>The type name or alias IGenericRepository'1[Design.DataModel.Entities.GaugeModel, Design.DataModel] could not be resolved. Please check your configuration file and verify this type name. </p>
  </blockquote>
  
  <p>I tried several other and it finally leads to brain death. Please help.</p>
  
  <p>Thanks</p>
  
  <p>Frans Verhoeven</p>