Code: Select all
[Table("PaymentUploads")]
public class PaymentUpload
{
[Key]
[Column("PaymentUploadId")]
public int Id { get; set; }
[Required]
[MaxLength(200)]
public string FileName { get; set; }
[Required]
public byte[] RawFileContents { get; set; }
public DateTime? ProcessedOn { get; set; }
public Guid? ProcessedById { get; set; }
[ForeignKey("ProcessedById")]
public virtual ApplicationUser? ProcessedBy { get; set; }
}
< /code>
dto: < /p>
public class PaymentUploadDto
{
public int Id { get; set; }
public string FileName { get; set; }
public DateTime TransactionDate { get; set; }
public decimal TotalPaymentAmount { get; set; }
public DateTime? ProcessedOn { get; set; }
public Guid? ProcessedById { get; set; }
public ApplicationUserPreview? ProcessedBy { get; set; }
}
< /code>
Profil: < /p>
CreateProjection();
< /code>
Anforderung: < /p>
DbContext.PaymentUploads.AsNoTracking().Where(g => g.CreatedOn >= createdOnOrAfter).ProjectTo(Mapper.ConfigurationProvider);
< /code>
Wenn wir das Profil ändern, um: < /p>
CreateProjection()
.ForMember(dest => dest.ProcessedBy, opt => opt.DoNotAllowNull());