Hi,
I am trying to work with silverlight, wcf data services ( on the website code) and Linq-to-Entities. I know that anonymous types don't work on silverlight then I created a known class in order to retrieve some information. (I know the query it is not exactly intelligent, but It is only an example) but It is not working. can somebody help me???
this is the code.
public class DataSummary
{
public DataSummary() { }
public int AccountID { get; set; }
public string Account { get; set; }
int accountID;
string account;
}
var p = (from q in svc.Accounts
select new DataSummary()
{ AccountID = (int) q.AccountID,
Account = q.Account1
}) as DataServiceQuery<DataSummary>;
p.BeginExecute(new AsyncCallback(r =>
{
try
{
this.grid.ItemsSource = p.EndExecute(r).ToList();
}
catch (Exception ex)
{
string message = ex.Message;
}
}), null);
when I run the example, the error message is
ex.Message "An error occurred while processing this request." string
it is so funny, because it is not explaining the problem.
Also in this question
http://stackoverflow.com/questions/2684954/silverlight-4-data-binding-with-anonymous-types
they said that we can used anonymous types, but then how can I put the "as DataServiceQuery.......... ??