CUD Methods won't fire
I'm trying to use RIA Services with Repository pattern, Every CRUD operations worked perfectly until I implemented the repositories. Now only query and Submit methods are working. I tried the methods both with and without Query, Insert, Update and Delete attributes.
Does anybody know what the problem is?
[LinqToEntitiesDomainServiceDescriptionProvider(typeof(MyEntityModelContainer))]
[EnableClientAccess()]
public class MyService : DomainService
{
internal IUnitOfWork ObjectContext { get; private set; }
public MyService(IUnitOfWork context)
{
this.ObjectContext = context;
}
public IQueryable<Employee> GetEmployees()
{
return this.ObjectContext.BusinessEntities.OfType<Employee>();
}
public void InsertEmployee(Employee employee)
{
this.ObjectContext.BusinessEntities.AddObject(employee);
}
public void UpdateEmployee(Employee currentEmployee)
{
this.ObjectContext.BusinessEntities.AttachAsModified(currentEmployee, this.ChangeSet.GetOriginal(currentEmployee));
}
public void DeleteEmployee(Employee employee)
{
if( (employee.EntityState == EntityState.Detached) )
{
this.ObjectContext.BusinessEntities.Attach(employee);
}
this.ObjectContext.BusinessEntities.DeleteObject(employee);
}
public over开发者_开发问答ride bool Submit(ChangeSet changeSet)
{
this.ObjectContext.Commit();
return true;
}
}
I have overrode the Submit method by mistake.
精彩评论