In my previous post I mentioned how to specify an association between POCO objects in RIA Services. In that post I did not mention that you will get an error as soon as you try to do some operations on associated objects. The error might look like this: "EntitySet of type 'Option' does not support the 'Add' operation".

There are two ways to solve the issue. First of all, it is necessary to decide what type of association you have. In case of composition you just need to use a new CompositionAttribute (read more in Mathew Charles' post):

// "Master" domain entity class.

public class Parameter {
    [Key]
    public long Id { get; set; }

    public string Name { get; set; }

    [Include]
    [Composition]
    [Association("Parameter_Options", "Id", "ParameterId")]
    public List<Option> Options { get; set; }
}

// "Details" domain entity class.

public class Option {
    [Key]
    public long Id { get; set; }

    public long ParameterId { get; set; }

    public string Name { get; set; }
}

If you do not have the compositional association, you have to specify operations in the corresponding domain service.

[EnableClientAccess]
public class ParametersDomainService : DomainService
{
    [Query]
    public IEnumerable<Parameter> GetParameters() { ... }
    [Insert]
    public void AddParameter(Parameter parameterWithOptions) { ... }
    [Update]
    public void UpdateParameter(Parameter parameterWithOptions) { ... }
    [Delete]
    public void DeleteParameter(Parameter parameterWithOptions) { ... }

    [Insert]
    public void AddOption(Option option) { ... }
    [Update]
    public void UpdateOption(Option option) { ... }
    [Delete]
    public void DeleteOption(Option option) { ... }
}

In the AddParameter, UpdateParameter and DeleteParameter methods you will receive the parameter object with associated options. It is up to you whether to perform operations on option objects together with operations on parameters or to do it in the corresponding methods. Note that AddOption, UpdateOption and DeleteOption should exist, but they could remain empty.