У меня есть такой общий метод:
Код: Выделить всё
public class DomainServiceBase : IDomainServiceBase where TEntity : class
{
public virtual async Task InsertAndSaveAsync(TRequest request)
{
// Implementations
}
}
Код: Выделить всё
public class AnnouncementDomainService : DomainServiceBase, IAnnouncementDomainService
{
public override async Task InsertAndSaveAsync(AnnouncementAddRequest request)
{
// an example of my issue
var title = request.Title // here i get CS1061 error
// Implementations
}
}
Это модель AnnouncementAddRequest:
Код: Выделить всё
public class AnnouncementAddRequest
{
public string Title { get; set; }
public string Code { get; set; }
public string? Description { get; set; }
public bool IsActive { get; set; }
public AnnouncementAddRequest()
{
Title = string.Empty;
Code = string.Empty;
}
}
I attach a screenshot from visual studio intelliSense

I am trying to override virtual generic method in the derived class so I can do validations and at the end, execute await base.InsertAndSaveAsync(request)
Источник: https://stackoverflow.com/questions/781 ... ric-method