Only primitive types are supported as parameters

This is the error message i got when tried to pass an array or List to an Ado Dataservice. It looks like you can only use int, string etc, when passing parameters to the webget method, this is a limitation on the Dataservice it self, not the Datacontext, you can easily workaround this by passing the comma separated values to the Dataservice then split the values before calling your DataContext.

To convert from the string array to the comma separated use this on your silverlight code:

string _csvproducts = string.Join(“,”, productList);

you webget method on the Dataservice should look like this:


public IQueryable<ModelWorkcenter> FilterByModelList(string models)


string[] _modelsqry = models.Split(‘,’).Select(sValue => sValue.Trim()).ToArray();

var result = this.CurrentDataSource.GetModelsByList(_modelsqry);

return result;


what im doing is to split again the values and passing them to the Datacontext method GetModelsByList this method is expecting a List<string> parameter. your Context class should look like this:

public IQueryable<ModelWorkcenter> GetModelsByList(IList<string> modelList)


var result = (from c in Scope.Extent<ModelWorkcenter>() where modelList.Contains(c.TopMaterial) select c);

return result;


This way your Linq to SQL will generate good SQL code using the IN clause something like

Select Model from ITEM_MASTER where Model in (‘model1’,’model2’,’model3’,’model4’)
To call the webget method use the CreateQuery method of your proxy class so you can add the parameter using AddQueryOption

public void CustomFilterModels(string models)


QryModelWorkcenter = Entities.CreateQuery<ModelWorkcenter>(“FilterByModelList”)

.AddQueryOption(“models”, “‘” + models + “‘”);

QryModelWorkcenter.BeginExecute(this.GetModelWorkcenterCallback, this.Entities);


Also note that I’m adding single quotes to the string, without quotes the url cant be parsed correctly and you will get syntax error. this is the generated Url:


I have read some post about very complex ways to do the same thing, others build the e-sql from scratch, I liked like this because seems more clear and easy to understand.

Please leave your comments.