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

  • SEARCH
  • Home
  • 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 8055113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:17:46+00:00 2026-06-05T08:17:46+00:00

I have the following class and a factory (omitted unnecessary code). I have 3

  • 0

I have the following class and a factory (omitted unnecessary code). I have 3 separate implementations of the IManageableEntryDao, and a string/type map that gets accessed in the createDao method.

I get the following compilation error: “ManageableEntry.IManageableEntryDao’ requires ‘1’ type arguments”. What’s the best practice in terms of solving this problem? Would I want to somehow determine what is? Or is there an alternative solution?

public interface IManageableEntryDao<T> where T : IManageableEntry {
    T findById(long id);
    T findByName(string name);

    int findUnapprovedCount();
    List<T> findUnapproved(ManageableEntryCriteria criteria);

    long insert(T manageableEntry);
    bool update(T manageableEntry);
    bool delete(T manageableEntry);
}

public class ManageableEntryDaoFactory {
    public IManageableEntryDao createDao(string manageableEntryType) {
            manageableEntryType = manageableEntryType.ToLower();
            Type type = daoTypes[manageableEntryType];
            if (type != null) {
                object dao = Activator.CreateInstance(type);                    
                return dao as IManageableEntryDao;
            }
            throw new NotImplementedException("Failed to find DAO for type: " + manageableEntryType);
        }
}
  • 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-05T08:17:47+00:00Added an answer on June 5, 2026 at 8:17 am

    You need to specify a type in the method call. This does mean you can probably avoid the need for the string:

    public IManageableEntryDao<T> CreateDao<T>() where T : IManageableEntry
    {
            Type manageableEntryType = typeof(T);
    
            // You'll need to modify daoTypes to be a HashSet<Type> (or List<Type>) of allowable types, or something similar, instead of using a dictionary lookup
            if (daoTypes.Contains(manageableEntryType) {
                object dao = Activator.CreateInstance(type);                    
                return dao as IManageableEntryDao<T>;
            }
            throw new NotImplementedException("Failed to find DAO for type: " + manageableEntryType);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: A disposable class that contains two disposable members. One
I have the following (simplified) code from a generic factory class: - (id) invokeSetup:
I have the following factory class: public class MessagePresenterCreator implements IPresenterFactory{ @Override public MessagePresenter
I have following code class User attr_accessor :name end u = User.new u.name =
I have the following class written by someone else that I'm trying to understand
I have the following class public class MenuVeiculo { public string Nome { get;
I have following code: class EntityBase (object) : __entity__ = None def __init__ (self)
I have a model not unlike the following: class Bike(models.Model): made_at = models.ForeignKey(Factory) added_on
I have the following class (with private .ctor and a public factory method) public
I have created the following class that extends JSpinner to iterate over dd/mm/yyy values.

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.