POCO inherited type could not pass addObject method

Posted by bryanevil on Stack Overflow See other posts from Stack Overflow or by bryanevil
Published on 2010-06-11T12:52:06Z Indexed on 2010/06/13 1:32 UTC
Read the original article Hit count: 356

Hi all

I am using a POCO class name "Company" generate from the T4 POCO code generator to create a derived class - name "CompanyBO" by "public class CompanyBO:Company", but when i call addObject method:

public void Delete(T entity)
        {
            CustomerWebPortalEntities entities = new CustomerWebPortalEntities();
                entities.AddObject(entity.GetType().BaseType.Name, entity);
                entities.DeleteObject(entity);
                SaveChanges();

        }

it compliant this:

The EntitySet name 'CustomerWebPortalEntities.Company' could not be found.
System.Data.Objects.ObjectContext.GetEntitySet(String entitySetName, String entityContainerName)
   at System.Data.Objects.ObjectContext.GetEntitySetFromName(String entitySetName)

Could you please tell me whats going wrong here? How do I resolve this problem?

Best Regards

Bryan

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about entity