I have previously written a post about including properties in WCF RIA Services. The post was using POCO as business model. If you use LINQ-to-SQL as your business model you might need some extra load options to get your associated properties sent from the server to the client.
You can add the extra load options in the domain service methods on the server. In my previous post I use two entities; a Company and an Employee entity. The Company entity has a Employee property called CEO.
First you need to add a reference to System.Data.Linq and add a using in the BusinessService.
Second you need to add the load options. In this case you want CEO to be loaded when the Company is loaded.
Finally you set the load options to the DataContext and then you’re ready to return your data as normal.
(In the code above I get an error on the DataContext; don’t mind that – it’s just because I used the sample code from the previous post that don’t use LINQ-to-SQL and there don’t recognize the DataContext object.)
If you have a Border (or another Control) and wish to set the background dynamically using an ImageBrush and wish to use databinding to set the ImageSource, you will get a runtime error.
You cannot use databing to set the ImageSource on an ImageBrush!
To work around this issue you can bind the background on the border instead and use a ValueConverter to generate the ImageBrush dynamically.
That should do the trick :)
WCF RIA Services provide lots of possibilities on getting data from the server to the client whether it is a Silverlight client or a console application.
One of the challenges that you may experience using WCF RIA Services is getting related properties to an entity to be included on the client. But no need to get scared – it is actually pretty easy.
First of all you need to create an association between your entity and the related entity. Lets say we have a company (Company) with a CEO (Employee):
When we get a list of companies from the client we would like to have the CEO property included and filled on the company. To do that we need to add a few attributes to the CEO property. Instead of adding the attributes on the entity object we can create a metadata file that holds this type of information.
Now the CEO property will be included, filled and ready to use when we call a query from the client that returns a list of companies.
You can download sample from my DropBox: http://dl.dropbox.com/u/4243120/SL%20Demos/RiaIncludePropertiesDemo.zip
VS2010 Beta 2 has support for SL3 development and includes SL3 SDK build 3.0.40818. There is a known issue installing VS2010 Beta 2 (and Web Developer Express 2010 Beta 2) on computers running SL3 SDK build 3.0.40624 that is installed with VS2008 and Expression Blend 3.
To fix the issue you need to uninstall SL3 SDK build 3.0.40624 from Add/Remove Programs and then install SL3 SDK build 3.0.40818 from http://go2.microsoft.com/fwlink/?LinkID=157102.
Så er billetsalget til Community Days 2010 åbent og agendaen er ved at være på plads.
- Udvikling af FireFox plugin,
- Hvodan bygger man et comunity ?,
- HTML 5,
- Single Sign On,
- AppFabric Distributed Cache (Velocity),
- Advanved jQuery,
- Hacking a website,
- Yahoo TV Widgets,
- Fra bygnings arkitektur til software arkitektur,MONO på Linux,
- Silverlight vs. Flash,
- Dependcy Injection,
- Tag med rundt om Azure løsning,
- IronPython og IronRuby,
- Nyt I Rails 3,
- Udskift ASP.NET med IronRuby on Rails,
- Grådige heuristikker,
- TDD eller hvordan bygger man et website i PHP i forhold til ASP.NET
Det går ned i Kedelhallen på Frederiksberg, i København, torsdag den 27. maj 2010 fra kl. 8:30. Og selvfølgelig griller vi et par dyr på en pind som sidste år, og naturligvis er der gratis fadøl, mad… ja faktisk er det helt gratis at deltage! Hvad venter du på ???
Tilmeld dig her!
Community Days 2010 bliver den 27. maj 2010 i Kedelhallen på Frederiksberg – så sæt kryds i kalenderen allerede nu! Mere info kommer snart!
Yesterday I did a talk about Silverlight 4 at a Øredev Knowledge Network event in Copenhagen, Denmark hosted by Jayway. The talk had focus on introducing Silverlight and the new possibilities that comes with Silverlight 4.
I hope that everybody could understand me even though I sounded like a geeky version of Godfather.
You can download the slides here and the demos here.