Entity Framework Code First Casting Columns
问题 I have an class public class Foo { public int UserId { get; set; } } and I'm using the code first fluent mapping to map this to the database. Property(i => i.UserId) .HasColumnName("userno"); the only problem is that userno is actually a char(10) in the database. How do I go about casting or converting this type? as I currently get this error. The 'UserId' property on 'Foo' could not be set to a 'String' value. You must set this property to a non-null value of type 'Int32'. Thanks 回答1: Entity