title: error 2019: Member Mapping specified is not valid using Entity Framework Code First
body: <p>I am implementing Entity Framework Code-First methodology in my project and got stuck in an issue.</p>
  
  <blockquote>
    <p><strong>Error Details:</strong> 18,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.Byte[Nullable=False,DefaultValue=]' of member
    'status' in type 'IMS.DAL.Users_mast' is not compatible with
    'SqlServer.binary[Nullable=False,DefaultValue=,MaxLength=8000,FixedLength=True]'
    of member 'status' in type 'CodeFirstDatabaseSchema.Users_mast'.</p>
  </blockquote>
  
  <p><strong>My Code:</strong>
  User_mast.cs file contains:</p>
  
  <pre><code>[Column(TypeName = "binary")]
  public byte status { get; set; } // Active | Inactive (1 | 0 ), where I want status column to be created as binary column in sql server.
  
  public class context : DbContext
  {
      public context()
          : base("name=sqlConn")
      {
      }
  
      public DbSet&lt;Users_mast&gt; Users { get; set; }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          base.OnModelCreating(modelBuilder);
      }
  }
  </code></pre>
  
  <p>and finally,</p>
  
  <pre><code>    context obj = new context();
  
      public void add()
      {
          obj.Users.Add(new Users_mast() {user_fname="Agnib", user_lname="Pyne", user_email="a@gmail.com", user_mobile="9830972301", username="agnib", pwd="As1232", created_date=DateTime.Now, status=1 });
          obj.SaveChanges();
      }
  </code></pre>
  
  <p>On running, I am getting the above error. I can understand its due to the status field set as byte which is not getting mapped as binary.</p>
  
  <p>Then what should I do to make the column in sql server as binary? Is there any list of mapping between sql server types and .net types specially in case of EF Code-First?</p>
  
  <p>Any help is appreciated. Please help!!!</p>