title: LINQ External Mapping to Class Library
body: <p>I've been struggling with a problem for the past couple days and haven't found a solution.</p>
  
  <p>I have an Visual Studio solution with 2 projects, the first one is a DLL with my business objects and logic, the other project is my WinForm application, and a reference dependency on the first project.</p>
  
  <p>I initially wrote the business objects with Attribute LINQ mapping and everything was working fine. Then I thought I would try external mapping. I followed a few different guides on how it should work; however, everytime I ran the code in my solution I would get a <em>InvalidOperationException: Mapping Problem: Cannot find type 'Org.Example.System.Material' from mapping</em>, when the WinForm attempts to create the DataContext object.</p>
  
  <p>After trying different configurations in the XML file I placed a copy of the class into my GUI solution under a different namespace and it worked. My question is, is it not possible to map an object in a class library or if it is how is it accomplished.</p>
  
  <p>Samples</p>
  
  <p><strong>dbmap.xml</strong></p>
  
  <pre><code>&lt;Database xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007" Name="Gravel_Dev"&gt;&lt;Table Name="dbo.Materials" Member="Material"&gt;
  &lt;Type Name="Org.Example.System.Material"&gt;
    &lt;Column Name="MaterialID" Member="MaterialID" Storage="mMaterialID" DbType="UniqueIdentifier NOT NULL" IsDbGenerated="true" IsPrimaryKey="true"/&gt;
    &lt;Column Name="Code" Member="Code" Storage="mMaterialCode" DbType="Char(4)"/&gt;
    &lt;Column Name="Description" Member="Description" Storage="mDescription" DbType="VarChar(50)"/&gt;
    &lt;Column Name="UnitPrice" Member="UnitPrice" Storage="mUnitPrice" DbType="Decimal(5,2)"/&gt;
  &lt;/Type&gt;
  </code></pre>
  
  <p>
      </p>
  
  <p><strong>WinForm Loading</strong></p>
  
  <pre><code>XmlMappingSource mapping = XmlMappingSource.FromUrl("dbmap.xml");
  mContext = new DataContext(Properties.Settings.Default.dbConn, mapping);
  reloadTable();
  </code></pre>