title: Code First Formatted Identity Column
body: <p>I'm using ASP.NET MVC with Entity Framework Code First and SQL Server 2014 database. </p>
  
  <p>I want to create a 'Customer' table with an autoincrement primary key which is formatted like this : CLI-X where X is the autoincrement number.</p>
  
  <p>Here is what I tried :</p>
  
  <pre><code>public class Customer
  {
      public int CustomerId { get; set; }
      public string CustomerNumber
      {
          get
          {
              return "CLI-" + CustomerId;
          }
          set { }
      }
      public string Name { get; set; }
  }
  
  public class CustomerMapping : EntityTypeConfiguration&lt;Customer&gt;
  {
      public CustomerMapping()
      {
          // Auto incrément ID
          HasKey(x =&gt; x.CustomerId);
          Property(x =&gt; x.CustomerId).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
  
          // Set CLI-ID as PK
          Property(x =&gt; x.CustomerNumber).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
      }
  }
  </code></pre>
  
  <p>Unfortunately, the column 'CustomerNumber' in is empty in the database when I create a new customer. I'd like this column to be formatted automatically instead of creating it myself each time I create a new customer.</p>
  
  <p>So my question is : How can I do in EF code-first to have a autoincrement primary key with a string prefix inside?</p>