Dapper.net Uzantıları kullanıyorum ve tam bir özel eşleştirici yazmadan belirli özellikleri yok saymak istiyorum. Aşağıda ClassMapper'da görebileceğiniz gibi, gerçekten tek yapmak istediğim çok fazla kod var. Bunu başarmanın en iyi yolu ne olurdu?Dapper.net Uzantıları kullanarak bir sınıf özelliğini nasıl yok sayarsınız?
Burada verilen yanıtı beğendim https://stackoverflow.com/a/14649356 ancak 'Yaz' tanımlandığı ad alanını bulamıyorum. Dapper.Contrib projenin parçası -
public class Photo : CRUD, EntityElement
{
public Int32 PhotoId { get; set; }
public Guid ObjectKey { get; set; }
public Int16 Width { get; set; }
public Int16 Height { get; set; }
public EntityObjectStatus ObjectStatus { get; set; }
public PhotoObjectType PhotoType { get; set; }
public PhotoFormat2 ImageFormat { get; set; }
public Int32 CategoryId { get; set; }
public int SomePropertyIDontCareAbout { get; set; }
}
public class CustomMapper : DapperExtensions.Mapper.ClassMapper<Photo>
{
public CustomMapper()
{
Map(x => x.PhotoId).Column("PhotoId").Key(KeyType.Identity);
Map(x => x.ObjectKey).Column("ObjectKey");
Map(x => x.Width).Column("Width");
Map(x => x.Height).Column("Height");
Map(x => x.ObjectStatus).Column("ObjectStatus");
Map(x => x.PhotoType).Column("PhotoType");
Map(x => x.ImageFormat).Column("ImageFormat");
Map(x => x.CategoryId).Column("CategoryId");
Map(f => f.SomePropertyIDontCareAbout).Ignore();
}
}
Nuget ISN'de Dapper.Contrib paketi': Sonra tekrar
Peter Ritchie'nin cevabı büyük olasılıkla daha fazla yer-üstünde ile t görünüyor lates kodu ile güncellendi. Güncellenmesi için sahibiyle iletişim kurdum. –
... ve şimdi güncellendi ve umarım gelecekte güncellenecektir. –