I am working on a small database service tool. My problem is that due to the last update, some small outlines had to be changed to integer ones.
public class TEST { public int ID { get; set; } //public Int16 ID { get; set; } public string TEST { get; set; } }
I changed the type from Int16 to int. Everything works fine, except that I can no longer use it with the old version of the database. The exception is something like "Expected System.Int32 found by Typ System.Int16."
Is there a way to pass all smallint and integer to int32?
Any ideas? My environment: EntityFramework 5.0.0.NET 4.5 FirebirdClient 3.0.2.0
I tried to force a throw in buildbuilder:
modelBuilder.Entity<TEST>() .Property(p => p.ID) .HasColumnType("smallint");
An exception:
error 2019: Membership indication is not valid. The type 'Edm.Int32 [Nullable = False, DefaultValue =]' of the participant identifier 'in Typ' ContextRepository.TEST 'is not compatible with the' FirebirdClient.smallint [Nullable = False, DefaultValue =, StoreGeneratedPattern = Identity] 'of the member "SCHLUESSEL" in type " CodeFirstDatabaseSchema.BUNDLAND "
Create an Int16 identifier and then run everything in smallint (HasColumnType ("int")) works fine, but will give me exceptions with numbers greater than 31767 (small maximum) ...
source share