title: EF6 MySQL StrongTypingException When Column is not PK
body: <p>We are using MySql and Entity FrameWork with VS 2013 those are the tools installed:</p>
  
  <ul>
  <li>MySql Server 5.7.8</li>
  <li>MySql WorkBench 6.3.</li>
  <li>MySql for Visual Studio 1.2.4</li>
  <li>Connector/NET 6.9.</li>
  <li>VS 2013 Ultimate</li>
  <li>Entity FrameWork 6.1.3 installed via NuGet</li>
  </ul>
  
  <p>We have imported the necesary libraries into the project MySQLWeb, MySQL.Data, Mysql.Data.Emtity.EF6</p>
  
  <p>We created a schema with MySQLWorkBench with a simple table like this:</p>
  
  <pre><code>CREATE TABLE `persona` (
    `idpersona` int(11) NOT NULL,
    `nombre` int(11) DEFAULT NULL,
    PRIMARY KEY (`idpersona`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  </code></pre>
  
  <p>The problem we have is that wuen we create the ADO.net Entity Data Model we connect right to the database but then it not creates the model and show the following error:</p>
  
  <blockquote>
    <p>'System.Data.StrongTypingException: El valor de la columna
    'IsPrimaryKey' de la tabla 'TableDetails' es DBNull. --->
    System.InvalidCastException: La conversión especificada no es válida. 
    en
    Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.TableDetailsRow.get_IsPrimaryKey()
    --- Fin del seguimiento de la pila de la excepción interna ---    en Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.TableDetailsRow.get_IsPrimaryKey()
    en
    Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateProperties(IList<code>1
    columns, IList</code>1 errors, List<code>1&amp; keyColumns, List</code>1&amp; excludedColumns,
    List<code>1&amp; invalidKeyTypeColumns)    en
    Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntityType(IList</code>1
    columns, Boolean&amp; needsDefiningQuery)    en
    Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntitySets(IEnumerable<code>1
    tableDetailsRows, EntityRegister entityRegister, IList</code>1
    entitySetsForReadOnlyEntityTypes, DbObjectType objectType)    en
    Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.CreateEntitySets(IEnumerable<code>1
    tableDetailsRowsForTables, IEnumerable</code>1 tableDetailsRowsForViews,
    EntityRegister entityRegister)    en
    Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.StoreModelBuilder.Build(StoreSchemaDetails
    storeSchemaDetails)    en
    Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
    en
    Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List<code>1
    errors)    en
    Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String
    storeModelNamespace, ModelBuilderSettings settings, List</code>1 errors)<br>
    en
    Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings
    settings, IVsUtils vsUtils, ModelBuilderEngineHostContext
    hostContext)'. La carga de los metadatos desde la base de datos tardó
    00:00:00.4029113. La generación del modelo tardó 00:03:36.0692240.</p>
  </blockquote>
  
  <p><strong>We have proved that if we make all single columns as Primary Key everything works fine, the problem happens when one column is not Primary Key</strong> it does not matter the type of the column.</p>
  
  <p>I didn´t find anyone with same problem on internet.</p>
  
  <p>Thank you very much for reading my question</p>
  
  <p>regards</p>