I have a class:
public class classParty
{
    private int _arrivedCount;
    public int PartyID {get; private set;}
    public DateTime PartyDate {get; private set;}
    public int ArrivedCount
    {
        get
        {
            return _arrivedCount;
        }
        set
        {
            _arrivedCount = value;
        }
    }
}
I can map the PartyId and the PartyDate but I don't have a column for ArrivedCount (it's a moment in time count, it doesn't persist).
How do I tell EF 4.1 to stop looking for a column named "ArrivedCount"? It's not in the table. It's not going to be in the table. It's simply a property of the object and that's all.
Thanks in advance.
EDIT: Here's the Fluent API configuration for classParty.
public class PartyConfiguration : EntityTypeConfiguration<classParty>
{
    public PartyConfiguration()
        : base()
    {
        HasKey(p => p.PartyID);
        Property(p => p.PartyID)
            .HasColumnName("PartyID")
            .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
            .IsRequired();
        Property(p => p.PartyDate)
            .HasColumnName("PartyDate")
            .IsRequired();
        ToTable("Party");
    }
}
The NotMapped attribute is used to specify that an entity or property is not to be mapped to a table or column in the database. In the following example, the AuditLog class will not be mapped to a table in the database: public class Contact.
Property Mapping. The Property method is used to configure attributes for each property belonging to an entity or complex type.
It is a tool to access the database. More accurately, it's classified as an Object/Relational Mapper (ORM) which means it maps data in a relational database into objects of our applications.
With data annotations:
[NotMapped]
public int ArrivedCount
//...
Or using Fluent API:
modelBuilder.Entity<classParty>()
    .Ignore(c => c.ArrivedCount);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With