Hi all
I have a generic CRUD class to perform add, delete, select, create to my entity objects.
one of them - Message has two derived classes - order_message , and report_message.
My problem is that in my generic class, I need an objectset to perform crud ops, but objectset does not accept a derived class type, it only accept base class type.
This is the error I received:
There are no EntitySets defined for the specified entity type 'CustomerWebPortal_Entities.Order_Message'. If 'CustomerWebPortal_Entities.Order_Message' is a derived type, use the base type instead.
I tried use typeof(T).BaseType to replace T, and of cause was not working.
How should I correct this?
This is the overview of the generic class:
public abstract class baseCrudDao<T> : ICrudDao<T> where T : class
{
private System.Data.Objects.ObjectContext _context;
private System.Data.Objects.ObjectSet<T> _entity;
public baseCrudDao()
{
_context = new CustomerWebPortalEntities();
_entity = _context.CreateObjectSet<T>(); <-- error at here, only accept base type
}