views:

14

answers:

0

I need to pass a set of values to a DomainService method. Here's what I'd like the service method to look like:

IQueryable<Person> GetPeople( Nullable<DateTime> MinDOB, IList<String> Ethnicities )
{
    return
        from
            Person item in ObjectContext.People
        where
            item.DOB >= MinDOB
            && Ethnicities.Contains( item.ETHNICITY )
        select
            item;
}

The query works fine with no parameters, and with just the DOB parameter it works fine. In the XAML, I can pass the DOB parameter via QueryParameters/QueryParameter as a parameter to the service method, or alternatively I can make the service method nonary, have it return everything, and stick the DOB parameter in a FilterDescriptor. Both work (with one caveat: I can't figure out how to make the FilterDescriptor XAML's IgnoredValue attribute work with a null DateTime). So far so good. But dates are scalar, and ListBox.SelectedItems isn't.

I keep getting the "must be one of the predefined serializable types" error on the service method as defined anything like the above (where's there a list of those forbidden scarlet types in MSDN, anyhow?), and the following doesn't work either:

<ria:DomainDataSource.FilterDescriptors>
    <ria:FilterDescriptor PropertyPath="ETHNICITY" Operator="IsContainedIn" Value="{Binding ElementName=_lbEthnicities, Path=SelectedItems}" />
</ria:DomainDataSource.FilterDescriptors>

It throws "Operator 'IsContainedIn' incompatible with operand types 'String' and 'ObservableCollection`1' ---> System.ArgumentNullException: Value cannot be null."

Should I give up and just define client C# code to stuff the selected listbox values into a string with delimiters, or something like that? I'm trying to push the declarative thing here as far as it'll go, but there's got to be a limit somewhere.