Verwenden von Datenbank erstes Designs und mit Tinyint (oder smallint) Säule:Tinyint (Byte), SmallInt (Int16) nicht kompatibel mit Enum in EF5
[MyEnumColumn] [tinyint] NOT NULL
ich diese Spalte Aufzählungstyp in EDM abgebildet mit
External Type: NSpace.MyEnumType
Name:MyEnumType
UnderlyingType:Byte
Wo NSpace.MyEnumType wie folgt definiert ist:
public enum MyEnumType
{ One, Two, Three, All }
Nur um diesen Fehler zu erhalten, wenn Entität zu laden versuchen, von Kontext:
Schema specified is not valid. Errors:
No corresponding object layer type could be found for the conceptual type 'EntityDataModel.MyEnumType'.
The following information may be useful in resolving the previous error:
The underlying type of CLR enumeration type does not match the underlying type of EDM enumeration type.
Gleiche gilt, wenn ich [Smallint] und [Int16], aber sobald ich Datenbank [Int] und Aufzählungstyp [Int32] der Fehler ist weg ändern.
Warum muss ich enum Wert in 4Byte (Int) Datenfeld anstelle von 1Byte (Tinyint) speichern, wenn enums in 99,9% Zeit nicht mehr als 256 Elemente haben oder fehlt mir etwas anderes?
dies auch den Fehler behoben, die ich heute hatte. So +1 – magicandre1981
Das rettete meinen Tag :) +1 – Midas
Nun, wenn jemand interessiert ist, ja sicher speichern Sie mich! Dank bro!! – CMS