title: Mapping an enum to a string
body: <p>I am in the process of migrating some old legacy database/code to Microsoft Entity Framework version 6 and have come across the following problem.</p>
  
  <p>The code-behind defines an enumeration and a POCO object as follows:</p>
  
  <pre><code>public enum AssetOwner {
      User = 1,
      Customer = 2,
      Supplier = 3
  }
  
  public class Asset {
     public int AssetId { get; set; }
     public string Reference { get; set; }
     public AssetOwner Owner { get; set; }
     ...
  };
  </code></pre>
  
  <p>In itself, this is fine, but the SQL table uses, for historical reasons I assume, the enum name rather than its value to store the data.  </p>
  
  <pre><code>create table [dbo].[Asset] 
  (
      [AssetId]     int           not null,
      [Reference]   nvarchar(50)  not null,
      [Owner]       nvarchar(20)  not null
      ...
  );
  </code></pre>
  
  <p>So the table might look like this:</p>
  
  <pre><code>1, 'asset-1', 'Customer'
  2, 'asset-2', 'Supplier'
  </code></pre>
  
  <p>Is there a way (I'm using EF Fluent Configurations) to be able to map the enum's name to the database column?</p>