2010-06-22 1 views
0

Я пытаюсь использовать службы RIA с шаблоном репозитория. Каждая операция CRUD работала отлично, пока я не реализовал репозитории. Теперь работают только методы запроса и отправки. Я пробовал методы как с атрибутами Query, Insert, Update, так и без них.Методы CUD не срабатывают

Кто-нибудь знает, в чем проблема?

[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 override bool Submit(ChangeSet changeSet) 
    { 
     this.ObjectContext.Commit(); 
     return true; 
    } 
} 

ответ