RIA Services Master Class Presenter: Kevin Grossnicklaus November 30th, 2010 Agenda • • • • • • • • Introductions Overview of RIA Services Setting up a new RIA Services Solution Common RIA Services Tasks Break Advanced Topics Additional Resources Conclusion Introductions • Kevin Grossnicklaus – ArchitectNow- www.architectnow.net (2009-Present) • President – Washington University - CAIT Program (2003-Present) • Instructor – SSE - www.SSEinc.com (1999-2009) • Chief Architect • Software Development Practice Leader • Email: kvgros@architectnow.net • Twitter: @kvgros • Blog: blog.architectnow.net ArchitectNow • • • • • • • Training Mentoring Framework Design and Implementation Code Reviews Project Development Short Term and Long Term Engagements As Needed Support EXPECTATIONS Assumed Knowledge • Basic Knowledge – C# – Silverlight/XAML – VS.NET 2010 • Optional (but useful): – XAML – Data Binding – MVVM – Entity Framework What is RIA Services? Silverlight Caching Entity Framework WCF Security Asynchronous Concurrency Data Validation LINQ What is RIA Services? Silverlight Entity Framework WCF Caching Security LINQ Concurrency Asynchronous Data Validation Data Access RIA Services is Data Layer Agnostic • Entity Framework • LINQ to SQL • POCO Objects – Custom data access Getting Started • Technologies – Visual Studio.NET 2010 – C# – Silverlight 4.0 – Entity Framework 4.0 – WCF RIA Services 4.0 • Initial Resources – www.Silverlight.net – Web Platform Installer Data Access RIA Services is Data Layer Agnostic • Entity Framework • LINQ to SQL • POCO Objects – Custom data access Alternatives • Manual WCF • Services – SOAP – JSON – Other Demo SETTING UP A NEW RIA SOLUTION USING RIA SERVICES Common Scenarios • Querying Data – LoadOperation • Adding Service Methods • Updating Data – Changesets – SubmitOperation • Error Handling • Data Validation – Data Annotations – HasValidationErrors • Sharing Code • Lazy Loading RIA Entities • Tracked By Context • Notable Attributes: – INotifyPropertyChanged – EntityState – GetOriginal() – HasValidationErrors – RejectChanges – GetConflict – ValidationErrors Troubleshooting • • • • • Accessing Services via URL Regenerating DomainContext Verifying entities are included in service API “Not Found” Exceptions Server Side Error Tracking (OnError) BREAK ADVANCED TOPICS UI Considerations • • • • • MVVM Data Binding Self Tracking Entities Context Sharing Asynchronous Loading Advanced Topics • • • • • • • Dynamic Queries Rejecting Local Changes Unit Testing Transaction Support Concurrency Caching Transactions Data Access Patterns • IRepository • SQL 2008 Database Project Security • Windows Authentication • ASP.NET Forms Authentication • FormsAuthenticationService – UserBase – Injecting UserBase derived classes – [RequiresAuthentication] Gotchas • • • • • • Multiple Domain Services Method Names Domain Service Public Interfaces Generating Temporary Domain Services Returning Complex Types EF Limitations: – No Many to Many – Advanced Inheritance • HasChanges on New Entities FINAL THOUGHTS Additional Resources • • • • • • • • • http://www.Silverlight.net http://Msdn.microsoft.com http://www.silverlightshow.net/ http://www.asp.net http://channel9.msdn.com/learn/courses/Silverlight4/ http://www.microsoft.com/design/toolbox/ http://www.microsoft.com/expression/resources/BlendTraining/ http://silverlight.codeplex.com/ http://compositewpf.codeplex.com/ Additional Resources (Cont.) • • • • • • • • http://channel9.msdn.com/Blogs/RobBagby/NET-RIA-Services-in-5-Minutes http://silverlight.net/riaservices/ http://www.silverlight.net/learn/videos/all/net-ria-services-intro/ http://www.silverlight.net/learn/videos/all/ria-services-support-visual-studio-2010/ http://channel9.msdn.com/learn/courses/Silverlight4/SL4BusinessModule2/SL4LOB_02_01_RIAServices http://www.myvbprof.com/MainSite/index.aspx#/zSL4_RIA_01 http://channel9.msdn.com/blogs/egibson/silverlight-firestarter-ria-services http://msdn.microsoft.com/en-us/library/ee707336%28v=VS.91%29.aspx • • • www.silverlight.net http://msdn.microsoft.com/en-us/silverlight4trainingcourse.aspx http://channel9.msdn.com/shows/silverlighttv Additional Resources Next Steps… • • • • Dive in Play around Ask Questions Research What if I need help? kvgros@architectnow.net Twitter: @kvgros