I have this object map for Entity Framework:
public WordDefinitionMap(string schema)
{
ToTable(schema + ".WordDefinition");
HasKey(x => x.WordDefinitionId);
Property(x => x.WordDefinitionId).HasColumnName(@"WordDefinitionId").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity);
Property(x => x.WordFormId).HasColumnName(@"WordFormId").IsRequired().IsUnicode(false).HasColumnType("varchar").HasMaxLength(20);
Property(x => x.Ascii).HasColumnName(@"Ascii").IsOptional().HasColumnType("int").HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Computed);
HasRequired(a => a.WordForm).WithMany(b => b.WordDefinitions).HasForeignKey(c => c.WordFormId);
}
public class WordDefinition
{
public int WordDefinitionId { get; set; }
public string WordFormId { get; set; }
public int? Ascii { get; set; }
public virtual WordForm WordForm { get; set; }
}
When I use the Entity Framework to try to update this object, I get an exception:
The column "Ascii" cannot be modified because it is either a computed column or is the result of a UNION operator.
I thought I already instructed EF to ignore this property, but it looks like it is still trying to update it, even if it is zero. Is there a way to change the display so EF does not set this property?
source
share