public abstract class BaseDocumentLayer : IDocumentLayer
{
public IDocumentLayer NextLayer { get;set;}
public virtual Document<T, U> ProcessDocument<T, U>(Document<T, U> document) {
if(NextLayer != null)
document = NextLayer.ProcessDocument(document);
return document;
}
}
public override Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> ProcessDocument<GenericDatabaseDTO, GenericDatabaseConstants.ActionType>(Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> document)
{
return base.ProcessDocument<GenericDatabaseDTO,
}
public static class GenericDatabaseConstants
{
public enum ActionType
{
CreateGeneric,
ReadGeneric,
UpdateGeneric,
DeleteGeneric,
}
}
为什么会出现错误:类型参数声明必须是标识符而不是类型?
错误1:
public override Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> ProcessDocument(Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> document)
{
return base.ProcessDocument(document);
}
错误 1 'GenericDocumentLayer2.Document.GenericDatabase.ProcessLayer.ProcessDocument(GenericDocumentLayer2.TypeDefinition.Document)':找不到合适的方法来覆盖
我没有更改我的原始 BaseLayer.ProcessDocument 方法
更新
public void Add(GenericDatabaseField field) {
var dto = new GenericDatabaseDTO();
dto.Field = field;
dto.Id = "test";
var document = new Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType>(dto, GenericDatabaseConstants.ActionType.CreateGeneric, null);
IDocumentLayer layer = DocumentFactory.CreateDocumentLayers();
// The generic ProcessDocument is never called just the base version
document = layer.ProcessDocument<GenericDatabaseDTO, GenericDatabaseConstants.ActionType>(document);
}