by luke smith for msdn .netbc group sept 8, 2011, luke ... · 8/9/2011 · accelerate the building...
TRANSCRIPT
• LightSwitch is a new Visual Studio Development tool from Microsoft, used to accelerate the building of Silverlight data centric business applications for desktop, web, and Azure cloud.
• LightSwitch application use model-centric n-tier architecture patterns based on Model-View-ViewModel (MVVM), Entity Framework and WCF RIA Services as building blocks.
• LightSwitch lets you focus on the business logic of the application by providing visual manipulation of data entities (tables and relationships) and screens to shorten the application development cycle.
• Data entities can be the built-in application database, or imported data from an external database, a SharePoint list, WCF RIA Services ,or other data source. You can create relationships between entities. You can also create queries.
• Screens (or forms) are based on predefined templates. You bind data to a screen to link the entities or queries to be displayed. After you create a screen, you can modify its appearance in the designer. Minimal coding is required.
• You can run and debug the application and then publish to IIS or Azure.
What is LightSwitch
My Social book
and
IssueTracker1
DEMO 1
LightSwitch Tiers
Presentation Tier (Silverlight 4)
Service Tier Data Tier
User Interface
Business Logic
Service Access
Service Interface
Business Login
Data Access
Service Interface
Screen Layout
Entity logic
Entity container
Data Service Entity
container
Entity Logic and
Pipeline
Data Provider
Block box (your code)
• Presentation tier is Silverlight 4 (in or out of browser)
• User interface consist of Shell, Screen, Theme, Controls
• Screen consist of Visual tree that contain content Items.
• Screens lays out content items automatically and content items and layouts can be changed dynamically (: time saver :)
• Screen contain Entity Type building blocks that encapsulate client business logic.
• Screen object and entity object are available at run time.
• Each screen object represents high-level unit of work the user will use.
• Each entity object represents a piece of business data, with encapsulated business rules like data validation.
• Entities are reused on the presentation and service tiers.
• Business rules show up as Computed properties, Validation rules (build in), authorization rules and read/write rules. Light switch uses lazy evaluation to update the rule at point of use. Results of business rule are accessed via the Details property.
• Each Client (screen) has a Data Workspace to access queries and entities. You can use LINQ queries to fetch data into the client or to initiate SaveChanges().
Presentation Tier
• Each data source is modeled as an Application Data Service and implemented in the service tier.
• The Service Tier is a hosted .NET 4 application that can run locally, in IIS or on Azure.
• Each Data Service has a service interface, server business logic and data access provider.
• The service interface is exposed as a WCF service end point.
• The business logic is accessed via a Data Workspace, the service side Data Workspace uses the data provider to access data sources.
• The server business logic consists of the query pipeline and the save pipeline.
• Two type of code in the pipeline are common entity code and interception methods. When a query is executed, The pipeline performs these steps:
• Pre-processing
• Validation
• Pre-preprocess entities
• Execution
• Post-process entities
• Port-processing
Server Tiers
• For application light switch defines Entity-Types as an Application Data object.
• Can use ADO.NET, WCF Data Services, or your own Shim use to talk with a WCF RIA domain Service that access MS SQL 2005, 2008, Azure.
• Share Point O DataFeed
• Other Entity Framework providers (some condition apply)
DataTier
LightSwitch PipeLine (partial view)
uteies
Post Process
GO
END
Initiate Update PipeLine for each source
SaveChanges_CanExecute SaveChanges_Executing
Execute Insert, Update, Delete for Entities in Change set
Call inserted, deleted, updated for All entities in change set
SaveChanges _ExcutionFailed
SaveChanges _Executed
Abort Transaction
Pre-Process
Validate
Pre-process entities
Execution
Post Process Entities
Start Transaction
Load cascade delete entities
Call CanRead, CanInsert, CanUpdate, CanDelete For each entity in change set
Validate modified entities in change set
Call inserting, deleting, updating for modified entities in change set
Commit Transaction
SaveChanges Called
exceptions
1
CanRun
CanExecute
PreProcess
Executing
Executed
ExecuteFailed
Demo2: Hooking into the Pipeline
Light Switch extension types
Business types - Let you wrap a base data type in a semantic type, providing additional validation and display capabilities in LightSwitch while continuing to store the data in its underlying type. They can include a Silverlight control for displaying data.
Custom controls - Silverlight user controls with additional attributes to make them usable in and better integrated with LightSwitch.
Data sources - Domain service adapter class that enables LightSwitch to work with other data sources.
Screen templates - Can be used to create screens that have common layout patterns different from the standard screen layouts provided by LightSwitch.
Shells - Let you create an application shell with a different layout and different capabilities than the standard LightSwitch application shell.
Themes - Let you create a different appearance and behavior for LightSwitch applications and controls.
You build extensions in visual studio using an experimental visual studio.
Light Switch Extensibility Toolkit
Add your theme extension
Demo3
In DXperience v2011 vol 1.7, DevExpress has introduced a LightSwitch extension to its award-winning XtraReports Suite.
• Easy-to-Activate Extension
• Fast Report Generation with Asynchronous Data Service
• Native Support for LightSwitch Data Structures
• Powerful and Easy-to-Use Report Designer
• No Runtime Royalties or Distribution Costs
• Get Started Now (free trails, try before buy)
DevExpress report extension
Rich design —a rich design experience to simplify the report generation process and to help you create compelling and informational reports with ease.
Seamless integration — interacts seamlessly with LightSwitch entities, leveraging your knowledge for maximum productivity. All standard tasks such as data binding, grouping, and sorting within LightSwitch are simple and repeatable processes. You also get instant access to more than 15 native XtraReport Controls, enabling you to incorporate advanced report elements such as bar codes and charts.
Built-in designer — customize your report to meet the needs of your most demanding users. Much like the Visual Studio form design surface, the XtraReports Designer simplifies the way in which you create business reports.
Integrated report preview — Once a report is generated using XtraReports for LightSwitch, it can be rendered, printed, and exported to numerous file formats via our easy-to-use Report Preview window. Report export options include PDF, HTML, Excel, and RTF.
DevExpress Light Switch XtraReports
Add your report extension
Demo 4
Whether you are building a data-entry application or displaying information from your database, DevExpress Data Editors for LightSwitch greatly simplify the way you deliver information to end users.
Simplified data presentation — With an interface that’s intuitive and uncluttered, DevExpress Data Editors give you many ways to define and display your most critical data.
Consistency and control — Data formatting rules can be as strict as you need them to be, ensuring consistency throughout all your databases.
Masked text edit — To maintain strict control over application data, you can use the DevExpress Mask Text Edit for LightSwitch to enforce data format rules. For instance, when entering phone numbers, you can require that users enter the area code in parentheses.
Accounting and percentage edit — The Accounting and Percentage Edit extensions for LightSwitch allow you to present and store information using currency and percentage values respectively.
Web image and Web link edit — The DevExpress Web Image extension allows you to display an image from a given URL, and the Web Link Edit allows you to launch and display the page referenced by the edit.
DevExpress LightSwitch Data Editors
Add Data Editor extension
Demo 5
The following are required in order to create Light Switch applications..
• Visual Studio 2010 SP1 (Professional, Premium, or Ultimate edition)
• Visual Studio 2010 SDK SP1
• Visual Studio Light Switch 2011
The following are required in order to create Light Switch extensions.
• You should be familiar with creating Visual Studio extensions using the Visual Studio 2010 SDK SP1.
• Visual Studio Light Switch 2011 Extensibility Toolkit
The following are required in order to use Dev Express report components from Light Switch
• Dev Express Release 11.1.7 or later
Light Switch and DevExpress Setup
Light Switch Developer Center
http://msdn.microsoft.com/en-us/lightswitch/default.aspx
Light Switch Samples and starter kits
http://www.microsoft.com/visualstudio/en-us/lightswitch/starter-kits
http://msdn.microsoft.com/en-ca/lightswitch/hh204519
Light Switch hosting
http://www.microsoft.com/visualstudio/en-us/lightswitch/hosting
Visual Studio LightSwitch 2011 Extensibility Toolkit
http://msdn.microsoft.com/en-us/lightswitch/hh304488
http://msdn.microsoft.com/library/hh304421
http://visualstudiogallery.msdn.microsoft.com/0dfaa2eb-3951-49e7-ade7-b9343761e1d2
Visual Studio Gallery
http://visualstudiogallery.msdn.microsoft.com
Light Switch References
DevExpress Release 11.1.7 (release note and download)
https://www.devexpress.com/ClientCenter/Downloads/#Trial
http://www.devexpress.com/Support/WhatsNew/DXperience/files/11.1.7.xml
DevExpress Light Switch Extensions (video and procedures)
http://www.microsoft.com/visualstudio/en-us/lightswitch/extensions/devexpress
http://www.devexpress.com/Products/NET/Controls/LightSwitch/
http://documentation.devexpress.com/#XtraReports/CustomDocument9900
http://documentation.devexpress.com/#XtraReports/CustomDocument10309
http://documentation.devexpress.com/#XtraReports/CustomDocument9819
DevExpress Reference
Developing Visual studio Extension
http://msdn.microsoft.com/en-us/library/dd885119.aspx
http://msdn.microsoft.com/en-us/library/dd393694.aspx
TechED
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/DEV211
http://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/DEV354
MSDN Magazine
http://msdn.microsoft.com/en-us/magazine/hh335061.aspx
http://msdn.microsoft.com/en-us/magazine/hh335065.aspx
Code Magazine Mar – Apr 2011 edition
http://www.code-magazine.com
Other useful references
• Luke Smith is the Lead Developer at SmithNetServices and for many years has contributed to Microsoft, MSDN and several other important businesses in the community to develop advanced applications and systems.
• These slides will be post on the following page http://www.smithnetservices.com/presentations.htm
• You can contact Luke at
Email: [email protected]
Phone: 778-847-1040
Web: http://www.smithnetservices.com
Luke Smith @