private ObservableCollection<MyEntity> _MyEntityList;
public ObservableCollection<MyEntity> MyEntityList
{
get{ return _MyEntityList; }
set
{
_MyEntityList = value;
RaisePropertyChanged("MyEntityList");
}
}
public void LoadData()
{
_Context.Load(_Context.GetMyEntityQuery(), LoadBehavior.RefreshCurrent,
DataLoaded, null);
IsBusy = false;
}
public void DataLoaded(LoadOperation<MyEntity> loadOperation)
{
if (loadOperation.HasError)
{
System.Windows.MessageBox.Show(loadOperation.Error.ToString(), "Load Error", System.Windows.MessageBoxButton.OK);
loadOperation.MarkErrorAsHandled();
MyEntityList = null;
}
else
MyEntityList = new ObservableCollection<MyEntity>(loadOperation.Entities);
IsBusy = false;
}
This blog is titled the way it is, because this is the method by which I came to learn most of the following information. 🤪
Thursday, June 24, 2010
Syntax for programmatically retrieving a recordset from RIAServices
Friday, May 28, 2010
Invoking a Method Call Over RIA Services
To invoke a method through RIA Services:
On the server side, declare the method, an decorate it with the [Invoke] annotation. Return types can be simple types or collections. Not sure if complex types work or not.
[Invoke]
public string BuildAdjusterMetricBatch(string users)
{
DoSomeWork()return batch;
}
On the client side, invoke the method, and pass it a function for the asynchronous Callback:
var context = new Web.Services.MSIClaimContext();
context.BuildAdjusterMetricBatch(txtFilter.Text,
BatchBuildCompleted, null);
then declare a method for the callback that matches the return type of the Method.
void BatchBuildCompleted(InvokeOperation<string>
invokeOperation)
{
string myValue = invokeOperation.Value;
DoClientSideWork();}
Tuesday, May 25, 2010
Load operation failed for query ‘GetUser’
Getting this error when deploying a Silverlight RIAServices application to a new server.
Fiddler helped debug this one. Pulling up the Response header in Fiddler gave the following additional information:
IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used
Had to reboot the server after making the change, but this resolved the problem.
Sunday, May 23, 2010
Calling a RIAServices Query from Code
var context = Project.Web.Services.DomainContext();
context.Load(
context.GetSomeItemQuery(parameters),
LoadBehavior.RefreshCurrent, DataLoaded, null);
void DataLoaded(LoadOperation<Web.Models.Entity> loadOperation)
{
loadOperation.Entities = …
Friday, May 21, 2010
Adding and Deleting from a RIAServices DomainDataSource
If you drag and drop a ‘Details’ form from the DataSources window onto a Silverlight form, by default you won’t have any add or save ability. To fix this, you have to add buttons to the form to do the Insert and Delete. The code behind for those buttons looks like this:
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
Web.Models.UserEdit newUser = new Web.Models.UserEdit();
userEditDomainDataSource.DataView.Add(newUser);
}
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
userEditDomainDataSource.DataView.Remove(userEditDomainDataSource.DataView.CurrentItem);
}