Retrieval of Single Entity + Ria Services
- by Oliver
Hi there,
I am reading and doing some RnD on RIA as a solution for a new Silverlight project.
I have read alot of the documentation and decided to do a small mockup of a system using .Net RIA Services.
I want to know how to get a Single Entity from the Domain Service?
example:
I want to get a person and populate a form:
public Person GetSinglePerson()
{
return new Person { ID = 4, FirstName = "Cyanide", LastName = "Happiness", Status=3 };
}
Say I use the the DomainDataSource:
<riaControls:DomainDataSource x:Name="source2" QueryName="GetSinglePersonQuery" AutoLoad="True">
<riaControls:DomainDataSource.DomainContext>
<web:DataContext/>
</riaControls:DomainDataSource.DomainContext>
</riaControls:DomainDataSource>
This only returns a EntityCollectionView? How do I bind for example in a form to properties that are in the Person Class?
Like:
<TextBox Text="{Binding FirstName, ElementName=source2}"/>
Everything seems to come back as IEnumerable or as CollectionViews (like the DATA binding in the samples) which aren't useful for a single entity.
I want a single persons entry, why do I want a CollectionView in which I cannot access properties directly.
I have also use the:
LoadOperation<Person> oLoadOperation = oDataContext.Load(oDataContext.GetSinglePersonQuery());
I am very close to giving up on this RIA idea and just going with a normal WCF service as it is more predictable and manageable at this stage.