360 likes | 482 Views
Line of Business Apps using WCF RIA Services. Andy Beaulieu MVP Silverlight MCT, MCSD.NET. About Me. Andy Beaulieu Based in Syracuse, NY MCT, MCSD.NET Microsoft MVP Silverlight WPF & Silverlight Insiders Full-time Developer, Part-time Trainer .NET Community:
E N D
Line of Business Appsusing WCF RIA Services Andy Beaulieu MVP Silverlight MCT, MCSD.NET
About Me • Andy Beaulieu • Based in Syracuse, NY • MCT, MCSD.NET • Microsoft MVP Silverlight • WPF & Silverlight Insiders • Full-time Developer, Part-time Trainer • .NET Community: • Speaker at User Groups, Code Camps, Conferences • User Group Leader - www.cnydevelopers.net • INETA Volunteer • Blog and Creations: • www.andybeaulieu.com • www.spritehand.com
Agenda Why Silverlight for Data Apps? Demos, Demos, Demos (and Beers)
Why Silverlight? • Stateful Model • Powerful UI Capabilities • Animation • Vector Graphics • .NET framework we know & love • Very Easy Deployment • Cross-Platform • Windows, Mac, Linux, Mobile Phones • Cross-Browser • No HTML/JavaScript oddities between browsers
Visual Studio 2010 Enhancements for Silverlight 4 Business Apps • Cider Designer Support • WYSIWYG Editing for Silverlight • Properties Panel + Events Panel • Document Outline Window • RIA Services • Simplified N-Tier Development • Data Sources Window • Drag/Drop Data Development
Demo Architecture • WCF RIA Services Timeframe • 7/2009: Preview • PDC 11/2009: Beta • Q1 2010: Release
Demo Architecture • Silverlight 4 & VS2010 Timeframe • PDC 11/2009: Beta • 2/2010: RC • Q1 2010: RTM
The Data Access Layer • Created using GUI Modeler • Programmer-Friendly Interface to Database Objects • Strongly Typed with IntelliSense • Compile-Time Checking of Database Classes
The Data Access Layer • LOTS OF CHOICES for Data Access Layer! • LINQ to SQL • Entity Framework • POCO • More coming? …
The Service Layer • WCF RIA Services • Simplifies Tiered Development • Write Code in one place • Code Generation • Validation • Uses Windows Communication Foundation • WCF Binary protocol used by default • Uses LINQ (Language Integrated Query) for Data Access • Current Version is WCF RIA Services Preview • Latest is 12/3/2009 • Release coming Q1 2010 • Usable from Other Clients • WindowsForms • ASP.NET AJAX
RIA Services in n-tier applications Automatic CRUD Web Service Layer • Validation Framework Trust Boundary Framework, tools and services with prescriptive pattern for n-tier applications Web Service Data Access Layer (DAL) App Logic App Logic View Database
The Silverlight Client : Grid • We can use the Data Sources Window to create a DataGrid • Drag/Drop to add a DataGrid and DomainDataSource control • DomainDataSourcesimplifies Editing, Paging, Grouping, Sorting and Filtering
The “Details Form” • We can use the Data Sources Window to create a Details View • Also creates a DomainDataSourcecontrol • Update, Delete, Add New easily added using DomainDataSource
Validation • Data Type check Validation is automatic • Other Validation can be added as attributes on Server Side • Automatically copied to Silverlight client • Custom Validation can be added using a “shared” class • Must be available on the Client + Server
Custom Validation • Custom Validation can be added using a “shared” class • Any class file containing “.shared.cs” or “.shared.vb” is automatically copied to Silverlight clientEX: CustomValidateColors.shared.csWe need to be careful to only use .NET classes that are supported in both Silverlight and .NET 3.5/4.0 framework!
List Bound Controls • We can use the Data Sources Window to create List Bound controls • Also creates a DomainDataSourcecontrol • NOTE: There can be timing issues with separate Domain Contexts! • We can solve this by creating a Static Resource and “sharing” the domain context.
Security • ASP.NET SQL Membership Provider supported Out of the Box • (we can support other auth mechanisms as well) • We can use attributes on the server side to enforce security • Access to Security Context • Client: • WebContext.Current.User • Server: • ServiceContext.User
Styling Styles are defined for a Business Application Template in Styles.xaml: … this ResourceDictionary defines many of the common styles of the App: Layout of “Master” page Background Link Buttons etc.
Programmatic Access • Don’t Like Declarative (in XAML)Data Access? • Taking an MVVM approach? • We can access all WCF RIA Services through code instead of Declaratively. • We can use Context object to access any Queries-OR- • We can create DomainDataSource in Code • Can also specify some LINQ queries from Client side
Questions? Email: andy@beaulieu.com Blog: www.andybeaulieu.com www.spritehand.com More Resources • RIA Services Home • http://silverlight.net/getstarted/riaservices/ • RIA Services Code Gallery • http://code.msdn.microsoft.com/RiaServices • Brad Abrams Series on RIA Serviceshttp://blogs.msdn.com/brada/archive/2009/08/02/business-apps-example-for-silverlight-3-rtm-and-net-ria-services-july-update-summary.aspx