title: MySQL 5.5 + .NET Connector + Entity Framework + Migrations = FormatException
body: <p>I tried to find a solution for my problem but my efforts until now was in vain. :-(</p>
  
  <p>I created a web project using Visual Studio 2010, .NET Framework 4, C#, Entity Framework 5.0, MySQL 5.5 and it's corresponding .NET connector (version 6.5.4). I'm using the code first approach for the entities and O/R mapping.</p>
  
  <p>The problem I'm faced with is that I'm unable to execute what seemed to be a simple migration. Here are my entity classes:</p>
  
  <pre><code>public class Usuario
  {
      public int Id { get; set; }
  
      [Required]
      [StringLength(100)]
      public string NomeCompleto { get; set; }
  
      [Required]
      [StringLength(100)]
      [DataType(DataType.EmailAddress)]
      public string Email { get; set; }
  
      [Required]
      [StringLength(30)]
      public string Login { get; set; }
  
      [Required]
      [StringLength(64)]
      public string Senha { get; set; }
  
      [Required]
      public bool Ativo { get; set; }
  
      //[Timestamp]
      [ConcurrencyCheck]
      public int Versao { get; set; }
  }
  
  public class Perfil
  {
      public int Id { get; set; }
  
      [Required]
      [StringLength(50)]
      public string Nome { get; set; }
  
      [StringLength(100)]
      public string Descricao { get; set; }
  
      //[Timestamp]
      [ConcurrencyCheck]
      public int Versao { get; set; }
  
      public virtual ICollection&lt;Usuario&gt; Usuarios { get; set; }
      public virtual ICollection&lt;Permissao&gt; Permissoes { get; set; }
  }
  
  public class Permissao
  {
      public int Id { get; set; }
  
      [Required]
      [StringLength(50)]
      public string Nome { get; set; }
  
      [StringLength(100)]
      public string Descricao { get; set; }
  
      //[Timestamp]
      [ConcurrencyCheck]
      public int Versao { get; set; }
  
      public virtual ICollection&lt;Perfil&gt; Perfis { get; set; }
  }
  </code></pre>
  
  <p>The code generated by <code>Add-Migration Acesso</code> (only <code>Up()</code> method):</p>
  
  <pre><code>public partial class Acesso : DbMigration
  {
      public override void Up()
      {
          CreateTable(
              "dbo.Usuario",
              c =&gt; new
                  {
                      Id = c.Int(nullable: false, identity: true),
                      NomeCompleto = c.String(nullable: false, storeType: "mediumtext"),
                      Email = c.String(nullable: false, storeType: "mediumtext"),
                      Login = c.String(nullable: false, storeType: "mediumtext"),
                      Senha = c.String(nullable: false, storeType: "mediumtext"),
                      Ativo = c.Boolean(nullable: false),
                      Versao = c.Int(nullable: false),
                  })
              .PrimaryKey(t =&gt; t.Id);
  
          CreateTable(
              "dbo.Perfil",
              c =&gt; new
                  {
                      Id = c.Int(nullable: false, identity: true),
                      Nome = c.String(nullable: false, storeType: "mediumtext"),
                      Descricao = c.String(storeType: "mediumtext"),
                      Versao = c.Int(nullable: false),
                  })
              .PrimaryKey(t =&gt; t.Id);
  
          CreateTable(
              "dbo.Permissao",
              c =&gt; new
                  {
                      Id = c.Int(nullable: false, identity: true),
                      Nome = c.String(nullable: false, storeType: "mediumtext"),
                      Descricao = c.String(storeType: "mediumtext"),
                      Versao = c.Int(nullable: false),
                  })
              .PrimaryKey(t =&gt; t.Id);
  
          CreateTable(
              "dbo.PerfilPermissao",
              c =&gt; new
                  {
                      PerfilId = c.Int(nullable: false),
                      PermissaoId = c.Int(nullable: false),
                  })
              .PrimaryKey(t =&gt; new { t.PerfilId, t.PermissaoId })
              .ForeignKey("dbo.Perfil", t =&gt; t.PerfilId, cascadeDelete: true)
              .ForeignKey("dbo.Permissao", t =&gt; t.PermissaoId, cascadeDelete: true)
              .Index(t =&gt; t.PerfilId)
              .Index(t =&gt; t.PermissaoId);
  
          CreateTable(
              "dbo.UsuarioPerfil",
              c =&gt; new
                  {
                      UsuarioId = c.Int(nullable: false),
                      PerfilId = c.Int(nullable: false),
                  })
              .PrimaryKey(t =&gt; new { t.UsuarioId, t.PerfilId })
              .ForeignKey("dbo.Usuario", t =&gt; t.UsuarioId, cascadeDelete: true)
              .ForeignKey("dbo.Perfil", t =&gt; t.PerfilId, cascadeDelete: true)
              .Index(t =&gt; t.UsuarioId)
              .Index(t =&gt; t.PerfilId);
  
      }
  }
  </code></pre>
  
  <p>First of all I had to change the properties named Versao (version) from</p>
  
  <pre><code>[Timestamp]
  public byte[] Versao { get; set; }
  </code></pre>
  
  <p>to</p>
  
  <pre><code>[ConcurrencyCheck]
  public int Versao { get; set; }
  </code></pre>
  
  <p>because an error ocurred before the change (something about the type rowversion not been qualified with a namespace or alias). After this change I was able to generate the migration but the <code>Update-Database</code> command failed with the following error shown in the console:</p>
  
  <pre><code>System.FormatException: Cadeia de entrada não estava em um formato incorreto.
      em System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal)
  </code></pre>
  
  <p>(Input string was not in not in a correct format.)</p>
  
  <p>I tried to use MySQL versions 5.5 and 5.1; the versions 6.5.4, 6.4.5 and 6.3.9 of the connector and couldn't solve the problem.</p>
  
  <p>Is it possible to use MySQL, Entity Framework and code first approach? If not, what are the consequences of switching to ODBC connector instead of the .NET one?</p>
  
  <p>Thanks in advance and sorry about the big question.</p>