I want to create a custom property on one of my entities mapped from the database, however this property is not mapped to the database, I created the property using partial
You can also mark your property with [NotMapped]
attribute or use Ignore
method from fluent API.
Property
public class EntityName
{
[NotMapped]
private string PropertyName { get; }
}
Fluent API
public class Entities : DbContext
{
public DbSet Users { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
// Some database configuration
modelBuilder.Entity()
.Ignore(i => i.PropertyName);
}
}