90 likes | 216 Views
Be The Master Of Your Domain with POCO WCF RIA Services. SILVERLIGHTSHOW.NET WEBINARS SERIES BRIAN NOYES, CHIEF ARCHITECT, IDESIGN INC 27 Sep 2011. About Brian. Publishing Developers Guide to Microsoft Prism 4, O’Reilly & Assoc., March 2011
E N D
Be The Master Of Your Domain withPOCO WCF RIA Services SILVERLIGHTSHOW.NET WEBINARS SERIES BRIAN NOYES, CHIEF ARCHITECT, IDESIGN INC 27 Sep 2011
About Brian • Publishing • Developers Guide to Microsoft Prism 4, O’Reilly & Assoc., March 2011 • Developing Applications with Windows Workflow Foundation, LiveLessons training DVD, June 2007 • Smart Client Deployment with ClickOnce, Addison Wesley, January 2007 • Data Binding in Windows Forms 2.0, Addison Wesley, January 2006 • MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side .NET, asp.netPRO, Visual Studio Magazine • Speaking • Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts Chief ArchitectIDesign Inc. (www.idesign.net) Microsoft Regional Director(www.theregion.com) Microsoft MVP Silverlight E-mail: brian.noyes@idesign.net Twitter: @briannoyes Blog: http://briannoyes.net
Agenda • RIA Services Overview • Defining POCO Domain Services • Defining Entities • Handling Concurrency • Entity Relationships
WCF RIA Services Overview Entities Validation Service Access • Simplifies building N-tier Line of Business (LOB) applications • Highly dependent on push pull of data • Can use for non-CRUD operations as well • Architecture and tools for building the glue code between the client and the back end • Streamlined pipeline for data and operations between client and server • Clients: Silverlight & ASP.NET • Future releases: ASP.NET client side JavaScript (WCF JQuery) WCF RIA Services Services Entities Validation Presentation Business Logic Data Access DB
Domain Service Classes • LinqToEntitiesDomainService • Can use with Entity Framework Database-first or Model-first models • Encapsulates access to the ObjectContext • Simplifies data access coding slightly • Not as efficient as you might like • DomainService • Up to you to implement data access and entity types • Still can leverage the full capabilities of RIA Services
Defining Entities • No specific base class or interface requirements • Plain Old CLR Objects (POCO) • Define properties • Must have a property or properties that are treated as a [Key] property • RIA Services needs to be able to uniquely identify each entity it transfers • May need additional attributes for related object properties, concurrency, and validation • Can use metadata classes
Handling Concurrency • Can lookup the original value on the server side from the data source • By default, RIA Services will not round trip original values of entity properties from the client for updates • Bandwidth optimization • Can indicate the desire for original values with the [RoundtripOriginal] attribute • Class or property level • Access the ChangeSet property • GetOriginal method
Handling Relations • Some properties on your entities may point to other entities • Child collections (i.e. Task has a collection of TimeEntries) • Parent / related object (Task may have a related Customer) • Decorate those properties with [Include] and [Association] attributes
Summary /Resources • POCO Entities give you maximum control over your object model • Need some attributes to decorate your entities • Do whatever kind of data access from your domain service you need • Still get full client framework richness • Silverlight Show WCF RIA Services Series: http://tinyurl.com/wcfriaseries E-mail: brian.noyes@idesign.net Twitter: @briannoyes Blog: http://briannoyes.net