WCF operationcontract with List type unavailable in (Silverlight) client
- by Dave
This is the first time I have tried returning a List of data to a Silverlight client, so I'm having trouble getting the client to recognize this operationcontract. All others are fine.
I have a method on the server called ReadOwFileData that needs to return a List. ReadOwFileDataCompletedEventArgs shows up in the Object Browser in the client, but not ReadOwFileDataAsync.
What I want is similar to the tutorial here.
The Dictionary collection type on the client is set to System.Collections.Generic.List. I tried deleting and recreating the service reference. Web.Config on the server is using basicHttpBinding.
Here is the operationcontract on the server:
[OperationContract]
public List<OwFileData> ReadOwFileData(string OrderID)
{
DataClasses1DataContext db = new DataClasses1DataContext();
var dFileData = (from p in db.OwFileDatas where p.OrderID == OrderID select p).ToList();
List<OwFileData> x = new List<OwFileData>(dFileData);
return x;
}
Incidently, this works fine:
[OperationContract]
public Customer GetShippingAndContactInfo(string login, string ordernum)
{
DataClasses1DataContext db = new DataClasses1DataContext();
Customer dInfo = (from p in db.Customers where p.Login == login select p).Single();
return dInfo;
}
I would like to read this data in the client and place it into an object I created called ObservableCollection. But that obviously can't happen until the client can see the method on the server.
I do not know if this is an acceptable start, but this is what is on the client so far. The ReadOwFileDataAsync object is null:
void populatefilesReceivedDataSource(string OrderID)
{
ArtUpload.ServiceReference1.UploadServiceClient client = new ArtUpload.ServiceReference1.UploadServiceClient();
var myList = client.ReadOwFileDataAsync(OrderID);
// can I just itterate thru the list instead of 'binding'
}