title: Restrict custom TypeConverter to a specific assembly
body: <p>I have defined a custom <code>TypeConverter</code> and associated custom <code>TypeDescriptionProvider</code> and <code>TypeDescriptor</code> so that my types are converted automatically to strings when returning values from a REST web service (using ASP.NET Core).</p>
  
  <p>However, I now notice that in other places in my application (e.g. when I am serializing XML saving my config files, or loading XAML in WPF) that my custom <code>TypeConverter</code> is being called.</p>
  
  <p>Is there a way of restricting my custom type converter / description provider / descriptor so that they are only used in my Web service assembly?</p>
  
  <hr>
  
  <p><strong>More info</strong></p>
  
  <p>My internal objects are not using <code>[TypeConverter()]</code> attributes to specify a type converter to use.</p>
  
  <p>I am using AutoMapper to do my mapping from my internal objects to data transfer objects, as an answer suggests. It is AutoMapper that makes use of the <code>TypeDescriptor</code>/<code>TypeConverter</code>, to map properties of my objects to strings automatically. I want the behavior to be so that <em>only</em> AutoMapper uses this custom type converter.</p>
  
  <p>However, type converters appear to be registered globally: <code>TypeDescriptor.AddProvider(customerProvider, myType)</code></p>
  
  <p>I cannot see a way of restricting this to just certain components. My only ideas so far are somehow using the <code>GetComponentName()</code> of the <code>ICustomTypeDescriptor</code> (but this appears always to be <code>null</code>) or running my Web server in a separate <code>AppDomain</code>, which I assume uses separate type converters, but would likely bring huge problems with marshalling/serialization. Is there another solution?</p>