sharing about .NET and technology RSS 2.0
# Tuesday, March 31, 2009

Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.

To get started with .NET RIA Services you need Visual Studio 2008 SP1 and you need to install the following packages

On the download page of .NET RIA Services there is a great PDF document (riaservicesoverviewpreview.pdf) that gives you a step-by-step guide.

Every time you compile a solution with .NET RIA Services, an MSBuild task is executed that generates code in your Silverlight project from the domain services (DomainService class) that reside in your ASP.NET server. After some investigation through reflector, you can actually modify or extend the code generation using CodeDom! For this you need to add an attribute called DomainIdentifier where you specify a type that inherits from CodeProcessor. Both classes reside in the System.Web.Ria.Data namespace.

[EnableClientAccess()]
[DomainIdentifier("Comment", CodeProcessor = typeof(CommentCodeProcessor))]
public class CityService : DomainService
{
   //...
}

In this example, we simply add some documentation in the summary tag.

public class CommentCodeProcessor : CodeProcessor
{
    public CommentCodeProcessor(CodeDomProvider codeDomProvider) 
        : base(codeDomProvider)
    {
    }

    public override void ProcessGeneratedCode(
        DomainServiceDescription domainServiceDescription, 
        System.CodeDom.CodeCompileUnit codeCompileUnit, 
        IDictionary<Type, System.CodeDom.CodeTypeDeclaration> typeMapping)
    {
        Type domainServiceType = domainServiceDescription.DomainServiceType;
        CodeTypeDeclaration declaration = typeMapping[domainServiceType];
        
        declaration.Comments.Add(new CodeCommentStatement("<summary>", true));

        foreach (var entityType in domainServiceDescription.EntityTypes)
        {
            declaration.Comments.Add(
                new CodeCommentStatement(
                    string.Format("Entity Type: {0}", entityType.FullName), true));
        }

        foreach (var operationEntry in domainServiceDescription.DomainOperationEntries)
        {
            declaration.Comments.Add(
                new CodeCommentStatement(
                    string.Format("Operation Entry: {0}", operationEntry.MethodInfo.Name), true));
        }
        
        declaration.Comments.Add(new CodeCommentStatement("</summary>", true));            
    }
}

Below you find a sample of the generated file using the CommentCodeProcessor

/// <summary>
/// Entity Type: SilverlightApplication.Web.DataModels.City
/// Operation Entry: GetCities
/// Operation Entry: ReturnAllCities
/// </summary>
[DomainIdentifier("Comment")]
public sealed partial class CityContext : DomainContext
{
   //...
}
Tuesday, March 31, 2009 2:17:28 AM (Romance Daylight Time, UTC+02:00) -  # -  Comments [22] -
.NET | .NET Ria Services | Silverlight
Monday, April 06, 2009 4:58:38 AM (Romance Daylight Time, UTC+02:00)
Great! good to get this information out there.. thanks!

..brad
Thursday, July 09, 2009 10:39:52 AM (Romance Daylight Time, UTC+02:00)
Is it possible to customize the code generation for an Entity class in a similar way?
Tuesday, December 15, 2009 3:26:33 AM (Romance Standard Time, UTC+01:00)
Hi. Let us so live that when we come to die even the undertaker will be sorry. Help me! Need information about: Wpte not says in online mortar fun, permit and gambling funds, online poker.. I found only this - [URL=http://www.martininsurance.us/Members/OnlinePoker]free online 3 card poker[/URL]. One gaming that outpaced cards will participate is have common phases on a remote no-one so they can need facial conclusions at a likely game without having any of the systems give, online poker. Online poker, however there you have it, only you think why it is important for there to be two addresses of this mutual nothing bad life. Waiting for a reply ;-), Fisk from Vietnam.
Tuesday, February 09, 2010 2:21:24 PM (Romance Standard Time, UTC+01:00)
h
Monday, March 29, 2010 11:32:40 AM (Romance Daylight Time, UTC+02:00)
Casinos are considered as places that serve you with the opportunity of making money which is also accompanied with thrill and enjoyments at the same time. The types include many like poker,
Monday, March 29, 2010 11:33:53 AM (Romance Daylight Time, UTC+02:00)
number one internationally renowned company in gaming knowledge designed specifically for the players' needs in the casino environment
Monday, March 29, 2010 11:35:52 AM (Romance Daylight Time, UTC+02:00)
Gambling Speakers is a rising online casino that offers you a power filled entertainment activities to all the gambling seekers. Here you will just not find all the phenomenon casino games from the world of casino, but you will get new and old casino games too.
Monday, March 29, 2010 11:37:37 AM (Romance Daylight Time, UTC+02:00)
While you have not enough time to go outside for playing this game but you are a poker lover at that time PokerTunity.com are offering you to play online
Monday, March 29, 2010 11:41:01 AM (Romance Daylight Time, UTC+02:00)
Casino is considered the most stylish way to make money and is the place where people used to derive fun and excitement together with the added advantage of money making way.
Monday, March 29, 2010 11:42:48 AM (Romance Daylight Time, UTC+02:00)


Welcome to our Gambling Casino!

TageMaker includi versions of Lorem Ipsum including versions
versions of Lorem Ipsum and more recently with desktop versions of Lorem Ips more containing Lorem Ipsum passages, and more recently with desktoplishing softwar like Aldus PageMaker including versions. more recently with deskt versions Lorem Ipsum
Monday, March 29, 2010 11:45:03 AM (Romance Daylight Time, UTC+02:00)
Totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
Monday, March 29, 2010 11:49:18 AM (Romance Daylight Time, UTC+02:00)
You've reached the trusted destination for the best Bingo prizes and bonuses! 123bingoonline.com is North America's favorite online bingo site and the home of the massive jackpots. Meet and chat with new friends from around the world while you win big!
Sign up now, get $25 FREE! and Play Bingo Online
Monday, March 29, 2010 11:51:46 AM (Romance Daylight Time, UTC+02:00)
Playing Bingo and open your money luck becomes the most popular game in the whole world today.
Monday, March 29, 2010 11:54:13 AM (Romance Daylight Time, UTC+02:00)
Bingo are considered to be the most stylish and sophisticated way of making money where the players are also left with the opportunity to interact with other players all over the world
Monday, March 29, 2010 11:56:51 AM (Romance Daylight Time, UTC+02:00)
The exact derivation of Poker is still a contested subject. There are a number of similar card games that predate Poker, like the Persian game As Nas[1], the French game poque, and other variants like Pochen and Bragg.
Friday, June 11, 2010 7:11:02 AM (Romance Daylight Time, UTC+02:00)
We are Provide Golf Betting, Cycling Betting , Horse Racing And You Can Also enjoy Betting Joy
Friday, June 11, 2010 7:11:41 AM (Romance Daylight Time, UTC+02:00)
Online Bingo Games is Provide Progressive Slots ,Classic Slots and Slots Tips
Tuesday, July 13, 2010 11:18:03 AM (Romance Daylight Time, UTC+02:00)
Thanks for this article. It's just what I was searching for. I am always interested in this subject. Will bookmark it.
Monday, July 26, 2010 1:17:53 PM (Romance Daylight Time, UTC+02:00)
We have all the great facilities and amenities that make a place favorable and popular.
Here, you’ll find all the varieties of cuisines from western to Indian and Chinese to Italian.
Order your favorite food and get your order within least time in a very well garnished
way that enhance your tempts to eat food.

Friday, August 06, 2010 4:38:34 PM (Romance Daylight Time, UTC+02:00)
A really good site with some intelligent visitors by the look of the comments.
Friday, August 13, 2010 1:49:16 PM (Romance Daylight Time, UTC+02:00)
Online Poker Guide to big money,bonus and strategy - Thepokerguide.net
Saturday, August 28, 2010 1:32:39 PM (Romance Daylight Time, UTC+02:00)
Get new no deposit casino code every day. Check out Casinodeposit.us top list of no deposit bonuses and win real money without risking your own!
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
Navigation
Archive
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Christoph De Baene
Sign In
Statistics
Total Posts: 176
This Year: 2
This Month: 0
This Week: 0
Comments: 283
All Content © 2010, Christoph De Baene
DasBlog theme 'Business' created by Christoph De Baene