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);
}
}