I have an EF4 object (first code) that includes an int bit mask. I created a Bitmask framework to make it easier to work with bitmaks (provides bool properties for accessing bits). The bitmask structure includes overloaded implicit operators for converting to and from int.
I tried to set the property type to the bitmask structure, but the value is returned as 0. I know that the value in the database matters, and the bitmask works in my unit tests. I set the HasColumnType parameter to "INT".
Property...
[Required]
[Display(Name = "Display Pages Bitmask")]
[Column(Name = "fDisplayPagesBitmask")]
public DisplayPagesBitmask DisplayPagesBitmask { get; set; }
From the context object ...
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<Website>()
.Property(m => m.DisplayPagesBitmask)
.HasColumnType("INT");
}
Is it possible? If so, what do I need to do to make it work?