Search code examples
silverlightwcf-ria-services

Silverlight RIA UsingCustomMethod not working


SL5 and latest RIA Services, from the XAML:

context.RemoveAccountFromRole(draggedPerson);

which gets called in the Domain Service when Invoke attribute is used:

 [Invoke]
 public void RemoveAccountFromRole(Account draggedPerson)

however when I use:

[Update(UsingCustomMethod = true)]
public void RemoveAccountFromRole(Account draggedPerson)

It never reaches the domain service when I set a breakpoint. Why?


Solution

  • It was a DomainContext issue - I was calling from the wrong context

    This is how to reference a XAML DomainContext from codebehind.

    custDomainContext context = (custDomainContext)AccountsDataSourceT32.DomainContext;
    context.RemoveAccountFromRole(draggedPerson, roleID);
    AccountsDataSourceT32.SubmitChanges();