130 likes | 256 Views
The Enterprise Web Framework. Greg Smalter Red Stapler Software, LLC. What is EWF?. EWF, the Enterprise Web Framework, is an environment in which to build data-centric web apps in a consistent way.
E N D
The Enterprise Web Framework Greg Smalter Red Stapler Software, LLC
What is EWF? • EWF, the Enterprise Web Framework, is an environment in which to build data-centric web apps in a consistent way. • The theme of the framework is to make the tough decisions for developers and prevent tedious work. • As always, we want to catch as many errors as possible at compile time.
Features • A new lifecycle • An automatically-generated user interface • Strongly-typed navigation • Auto data modification • Concurrency conflict checking
Motivation for a new lifecycle • The ‘put everything in page_load’ strategy does not work well. • Understanding when to use Init, Load, and PreRender is difficult. • We want to eliminate scattered ‘if (!IsPostBack)’ statements. • The tendency to rely on ViewState is problematic.
The EWF lifecycle • Developers never implement Init, Load, or PreRender. • Instead, the lifecycle looks like this to the developer: • LoadData • ValidateFormValues • ModifyData
LoadData • Contains all logic not related to validation or data modification • Controls can be added dynamically here. • The values of all controls are populated here.
ValidateFormValues • Is provided with a new Validator object • Uses the Validator’s built-in methods to do common validation and type conversion • If any validation errors exist in the Validator after the method executes, the framework automatically adds the error messages to the status area.
ModifyData • Is only executed if ValidateFormValues resulted in no validation errors • Is provided with an open database connection in a transaction • Successful execution triggers a new lifecycle in order to load the newly-modified data.
Automatic UI generation • Optional • Uses the file system to make inferences about site organization • Developers add elements to designated locations – the framework places the element
Strongly-typed navigation • Bad links within your own site are no longer possible. • Query parameters are now strongly typed – no more string parsing. • Parameters can be passed at the entity level or at the page level.
Auto data modification • Applied on a per-page basis - useful for common forms such as a personal information page • Pages that use this should behave like a piece of paper. • All data is persisted on any type of postback, including navigating away. • Unnecessary database interactions are avoided by change detection.
Concurrency checking • Basic automatic conflict detection prevents overwriting another user’s changes, alerts users to concurrent modifications. • Requires no additional database interaction or extra developer code • Presents user with options for conflict resolution