Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:02:22+00:00 2026-06-10T08:02:22+00:00

public abstract class BaseDocumentLayer : IDocumentLayer { public IDocumentLayer NextLayer { get;set;} public virtual

  • 0
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,               
    }
}

Why do I get the error: Type paramter declaration must be an identifier not a type?

enter image description here

Error1:

public override Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> ProcessDocument(Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> document)
{   

    return base.ProcessDocument(document);
}

Error 1 ‘GenericDocumentLayer2.Document.GenericDatabase.ProcessLayer.ProcessDocument(GenericDocumentLayer2.TypeDefinition.Document)’: no suitable method found to override

I have not changed my origin BaseLayer.ProcessDocument method

UPDATE

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);                
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:02:24+00:00Added an answer on June 10, 2026 at 8:02 am

    You can’t override a generic method for a specific type. This is possible with C++’s templates but not with C#’s generics.

    To make your code compile, change it to this:

    public override Document<TDTO, TActionType> ProcessDocument<TDTO, TActionType>(Document<TDTO, TActionType> document) 
    

    This will compile, but it will override the base type method for all generic arguments.

    If you want to provide a special implementation just for one type, you can add a non-generic overload and internally call the generic version after the special handling:

    public Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> ProcessDocument(Document<GenericDatabaseDTO, GenericDatabaseConstants.ActionType> document)  
    {
        // some special handling for this special case here...
    
        return base.ProcessDocument(document);
    }
    

    However, please note that this will break in polymorphic scenarios like this one:

    Assume the methods above are implemented in Derived. Derived is derived from Base

    GenericDatabaseDTO dto = /*...*/;
    GenericDatabaseConstants.ActionType actionType = /*...*/;
    
    Derived d = new Derived();
    Base b = d;
    
    // calls the non-generic version with special handling from Derived:
    d.ProcessDocument(dto, actionType);
    // calls the generic version from Base:
    b.ProcessDocument(dto, actionType);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public abstract class Entity : IEntity { [Key] public virtual int Id { get;
[ProtoContract] public abstract class Animal { [ProtoMember(1)] public abstract string Type { get; set;
Given the class': public abstract class AbstractEntity { public virtual Guid Id { get;
Consider this abstract class public abstract class Foo { public Injectable Prop {get;set;} }
Example: public abstract class BaseControler : Controller { public IUnitOfWork UnitOfWork { get; set;
public abstract class Animal , IValidatableObject { public string Id {get;set;} public string Name
public abstract class ContentManagedEntity { public Guid Guid { get; set; } public bool
Entities public abstract class Person { public string FirstName { get; set; } public
Given the model: public abstract class Person { public int Id {get;set;} } public
i have an abstract class public abstract class Document { public int DocumentID {get;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.