1

Im using DapperExtensions library for simple CRUD operations. When I add a navigate property to my model, I get an error message that this column is not in the database. Can you in any way change this so that Dapper Extensions ignores this property?

Example of my model

public class Order : EntityBase
{
    public int OrderId { get; set; }
    public int MarketId { get; set; }
    public int ModelId { get; set; }
    public int ContactId { get; set; }
    public string Project { get; set; }
    public decimal Undertaking { get; set; }

    public virtual Model Model { get; set; }
    public virtual Contact Contact { get; set; }
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Nils Anders
  • 4,212
  • 5
  • 25
  • 38

2 Answers2

2

Use the Write attribute above the property

[Write(false)]
Jeroen K
  • 10,258
  • 5
  • 41
  • 40
1
  1. add the package for dapperextentions
  2. AutoMap(); will map all other properties as long as you have the same name for the field.
public class CustomMapper : DapperExtensions.Mapper.ClassMapper<Photo>
    {
        public CustomMapper()
        {
           Table("TableName if diffrent than the Model calss name");
           Map(f => f.SomePropertyIDontCareAbout).Ignore();
           AutoMap();
        }
    }