Archivo de la etiqueta: Entity framework

Potential runtime violation of table keys

Este error:

Problem in Mapping Fragment starting at line NroLinea: Potential runtime violation of table Tabla’s keys (Entidad.Key): Columns (Entidad.Key) are mapped to EntitySet Tabla’s properties (Tabla.keyNuevo) on the conceptual side but they do not form the EntitySet’s key properties (Tabla.Key1, Tabla.Key2, Tabla.Key3)

Sucede cuando agregamos el diseño relacional una tabla sin primary key, entonces el EF hace que todas los campos sean key, o cuando teniamos varias keys y quitamos algunos key’s.

Por alguna razon el EF no quita esos PK al actualizar el Entity Data Model, hay que editar el XML del archivo edmx, buscar la definicion:

 <EntityType Name="Tabla">

Y dentro de Key borrar los PropertyRef de los campos que antes estaban como key y ahora ya no estan.