Inheritance Revert override - Habilya/LearningCourseNotes GitHub Wiki
public class GrandBase
{
protected void DefaultPopulateMetaData_Status(ECMAPINewDocumentModel documentToUpload, Regex regex, PdfElement pdfElement)
{
var status = GetMembershipStatusFromMappingFile(pdfElement.ExtractIdentifierElement.ExtractIdentifierElementArray);
if (!string.IsNullOrWhiteSpace(status))
{
documentToUpload.MetaData.Add(FileNetHelper.METADATA_STATUS, status);
}
}
protected virtual void PopulateMetaData_Status(ECMAPINewDocumentModel documentToUpload, Regex regex, PdfElement pdfElement)
=> DefaultPopulateMetaData_Status(documentToUpload, regex, pdfElement);
}
public class SubClass : GrandBase
{
protected override void PopulateMetaData_Status(ECMAPINewDocumentModel documentToUpload, Regex regex, PdfElement pdfElement)
{
// Custom logic here
}
}
// see we inherit the redifinition of PopulateMetaData_Status from SubClass
public class SubSubClass : SubClass
{
// This is how you "come back" to the default logic while keeping other redifinitions
protected override void PopulateMetaData_Status(ECMAPINewDocumentModel documentToUpload, Regex regex, PdfElement pdfElement)
=> DefaultPopulateMetaData_Status(documentToUpload, regex, pdfElement);
}