Download presentation
Presentation is loading. Please wait.
Published byEustace Watson Modified over 9 years ago
1
ASP.NET: Designing and Developing a Line-of-Business Web Application Ammar Abuthuraya Developer & Platform Lead Microsoft ® Corporation
2
What We Will Cover Definition of a line-of-business application Definition of a line-of-business application Time Tracker as example of line-of- business application Time Tracker as example of line-of- business application Design and technology choices Design and technology choices Development techniques Development techniques Intranet security design and implementation Intranet security design and implementation
3
Session Prerequisites Level 200 Ability to read C# code Ability to read C# code Working knowledge of ASP.NET Working knowledge of ASP.NET Familiarity with Microsoft ® Visual Studio ®.NET Familiarity with Microsoft ® Visual Studio ®.NET
4
So Why This Presentation? Provide overview of best practices for Provide overview of best practices for Application architecture Development Outline key features of ASP.NET and the.NET Framework Outline key features of ASP.NET and the.NET Framework Promote the ASP.NET Starter Kits at www.asp.net Promote the ASP.NET Starter Kits at www.asp.net
5
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Mobile Mobile Globalization Globalization Security Security Deployment Deployment
6
Introduction The Time Tracker Line-of-Business Web Application What is a line-of-business application? What is a line-of-business application? Time Tracker allows users to track hours worked on a project Time Tracker allows users to track hours worked on a project Allows managers to monitor project status Allows managers to monitor project status Per user Per project Allows administrators to manage user accounts and projects Allows administrators to manage user accounts and projects
7
Introduction The Time Tracker Line-of-Business Web Application Illustrates best practices for intranet application development Illustrates best practices for intranet application development Serves as a template for other line-of-business applications Serves as a template for other line-of-business applications
8
Demonstration 1 Time Tracker Functionality Registering as a New User Creating New Users Creating a Project Creating Time Entries Generating Reports Logging on as a Less-Privileged User Time Tracker Starter Kit
9
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Mobile Mobile Globalization Globalization Security Security Deployment Deployment
10
Design Goals Decisions for an Intranet Application Emphasis on maintenance, not performance Emphasis on maintenance, not performance Can utilize company’s existing user information Can utilize company’s existing user information Clean separation between logical tiers Clean separation between logical tiers Enables code reuse by other applications
11
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
12
Application Architecture Logical 3-tier Design
13
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
14
Data Layer Database Schema Requirements User enters time for project and category User enters time for project and category User role authorization User role authorization Time entries require user project membership Time entries require user project membership Project has one or more categories Project has one or more categories Projects can have one project manager Projects can have one project manager
15
Data Layer Database Schema
16
Data Layer Stored Procedures Provide separation between database and data access layer Provide separation between database and data access layer Performance benefits Performance benefits Added security Added security Can change with no effect to data layer Can change with no effect to data layer ListTimeEntries helps enforce role authorization ListTimeEntries helps enforce role authorization
17
Data Layer Data Access Uses Data Access Application Blocks (DAAB) Uses Data Access Application Blocks (DAAB) Time Tracker uses ExecuteDataSet method Time Tracker uses ExecuteDataSet method Reduces custom code from six or more lines to one or two Reduces custom code from six or more lines to one or two DataSet ds = SqlHelper.ExecuteDataSet( ConfigurationSettings.AppSettings[ ConfigurationSettings.AppSettings[ Web.Global.CfgKeyConnString], Web.Global.CfgKeyConnString], CommandType.StoredProcedure, CommandType.StoredProcedure, “ListAllProjects”); “ListAllProjects”);
18
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
19
Business Logic Layer Application-specific Code Implements how a company does business Implements how a company does business
20
Business Logic Layer Application-specific Code Distinct from UI and database-specific code Distinct from UI and database-specific code Enables code reuse Enables code reuse Functionality available to Web services Functionality available to Web services Implements security Implements security Classes wrap information from data access code Classes wrap information from data access code
21
Business Logic Layer TTUser Class Each name represents an instance of the TTUser class Each name represents an instance of the TTUser class
22
Business Logic Layer TTUser Class Public properties that contain user info Public properties that contain user info UserID Role string Methods interact with data access layer to: Methods interact with data access layer to: Return lists of users Return user information Manage user information Log users in
23
Business Logic Layer Custom Collections Derive from ArrayList Derive from ArrayList Require less memory than DataSet and others Require less memory than DataSet and others Provide cleaner separation between data and presentation layers Provide cleaner separation between data and presentation layers Each collection a class-specific object (UsersCollection maps to TTUser ) Each collection a class-specific object (UsersCollection maps to TTUser )
24
Business Logic Layer Other Features Static methods Static methods Belong to the type itself Object needn’t be instantiated ProjectGrid.DataSource = Project.GetProjects(); ProjectGrid.DataSource = Project.GetProjects(); Retrieving user info Retrieving user info Configure to Microsoft ® Active Directory ® or Windows ® NT ® SAM need to retrieve user info from account source DirectoryHelper class Retrieves user first and last name from account source Easily extendable
25
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
26
Presentation Layer Introduction Provides user interface Provides user interface Communicates directly with business logic Communicates directly with business logic Separate from data access and business layers Separate from data access and business layers Can develop multiple UIs that use code from other layers
27
Presentation Layer User Controls Banner and all tabs are user controls Banner and all tabs are user controls
28
Presentation Layer DataGrid with Inline Editing Define EditItemTemplate Column Define EditItemTemplate Column Fill column with another ASP.NET server control Fill column with another ASP.NET server control
29
Agenda Introduction Introduction Design Goals Design Goals Application Architecture Application Architecture Data Layer Data Layer Business Logic Layer Business Logic Layer Presentation Layer Presentation Layer Report Creation Report Creation GDI+ Chart Creation GDI+ Chart Creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
30
Report Creation Project Report Created per selected project Created per selected project Grouped by project, category, consultant Grouped by project, category, consultant Created with nested DataList controls Created with nested DataList controls Data source assigned at run time Data source assigned at run time DataSource=‘ ’
31
Report Creation Resource Report Compiles time entry lists Compiles time entry lists Can contain one or more consultants Can contain one or more consultants Created with a DataGrid nested in a DataList control Created with a DataGrid nested in a DataList control
32
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
33
GDI+ Chart Creation Chart Page Separate page needed to render chart Separate page needed to render chart Uses query strings to pass graph data Uses query strings to pass graph data Returns Portable Network Graphics (PNG) format Returns Portable Network Graphics (PNG) format
34
GDI+ Chart Creation Chart Classes ChartItem—a single data point ChartItem—a single data point ChartItemsCollection—collection of data points ChartItemsCollection—collection of data points Chart—abstract class Chart—abstract class Defines Draw() method that must be overridden Limits data points for derived graphs BarGraph—performs calculations for graph generation BarGraph—performs calculations for graph generation
35
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
36
Security Authentication Forms authentication on install Forms authentication on install Easily modified to Microsoft ® Windows ® authentication Easily modified to Microsoft ® Windows ® authentication Active Directory NT Security Authorization Manager (SAM) Make changes in Web.config Make changes in Web.config
37
Security Authorization and Techniques Roles-based Roles-based Consultant Project Manager Administrator Roles define: Roles define: page access Tasks user allowed to perform User input cleaned User input cleaned
38
Demos Demonstration 2 Code Walkthrough Review the Data Access Layer Review the TTUser Class Review the UsersCollection Class Review the TTSecurity Class Review CustomPrincipal and Global.asax.cs Review the Chart class Review TimeEntry.aspx.cs and associated files Review Banner.ascx.cs class
39
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
40
Mobile Time Tracker Device Support Users can view, add or update entries Users can view, add or update entries
41
Agenda Introduction Introduction Design Goals Design Goals Application Architecture Application Architecture Data Layer Data Layer Business Logic Layer Business Logic Layer Presentation Layer Presentation Layer Report Creation Report Creation GDI+ Chart Creation GDI+ Chart Creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
42
Globalization Using the CultureInfo Class Culture settings changed per user’s browser settings Culture settings changed per user’s browser settings Application_BeginRequest method in Global.asax performs check Application_BeginRequest method in Global.asax performs check if (Request.UserLanguages != null) Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture( CultureInfo.CreateSpecificCulture( Request.UserLanguages[0]); Request.UserLanguages[0]);else Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentCulture = new CultureInfo(“en-us”); new CultureInfo(“en-us”); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; Thread.CurrentThread.CurrentCulture;
43
Agenda Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
44
Deployment Web Farm Considerations Encrypted cookie’s key must be same Encrypted cookie’s key must be same Set machineKey in each Web.config file to same value Set machineKey in each Web.config file to same value For pages that require session state For pages that require session state Set load-balancing affinity, or Session state must be stored in a state server or Microsoft ® SQL Server™
45
Demos Demonstration 3 Configuring the Time Tracker Application Review the Web.Config File Change the User’s Default Role Change Forms Authentication to Windows NT SAM Authentication
46
Session Summary Introduction Introduction Design goals Design goals Application architecture Application architecture Data layer Data layer Business logic layer Business logic layer Presentation layer Presentation layer Report creation Report creation GDI+ chart creation GDI+ chart creation Security Security Mobile Mobile Globalization Globalization Deployment Deployment
47
For More Information… MSDN Web site at MSDN Web site at msdn.microsoft.com Official ASP.NET Web site at Official ASP.NET Web site at www.asp.net
48
Training and Events MSDN Webcasts, MSDN Online Seminars, Tech·Ed, PDC, Developer Days MSDN Essential Resources for Developers Subscription Services Online Information Membership Programs Print Publications Library, OS, Professional, Enterprise, Universal Delivered via CD-ROM, DVD, Web MSDN Online, MSDN Flash, How-to Resources, Download Center MSDN User Groups MSDN Magazine MSDN News
49
How-to Resources Simple, Step-by-Step Procedures Embedded development How-to resources Embedded development How-to resources General How-to resources General How-to resources Integration How-to resources Integration How-to resources JScript ®.NET How-to resources JScript ®.NET How-to resources Microsoft.NET development How-to resources Microsoft.NET development How-to resources Office development resources Office development resources Security How-to resources Security How-to resources Microsoft Visual Basic.NET How-to resources Microsoft Visual Basic.NET How-to resources Microsoft Visual C# ®.NET How-to resources Microsoft Visual C# ®.NET How-to resources Microsoft Visual Studio.NET How-to resources Microsoft Visual Studio.NET How-to resources Web development How-to resources (ASP, IIS, XML) Web development How-to resources (ASP, IIS, XML) Web services How-to resources Web services How-to resources Windows development How-to resources Windows development How-to resourceshttp://msdn.microsoft.com/howto
50
MSDN Webcasts Interactive, Live Online Events Interactive, synchronous, live online events Interactive, synchronous, live online events Discuss the hottest topics from Microsoft Discuss the hottest topics from Microsoft Open and free for the general public Open and free for the general public Take place every Tuesday Take place every Tuesdayhttp://www.microsoft.com/usa/webcasts
51
MSDN Subscriptions The Way to Get Visual Studio.NET Visual Studio.NET MSDN Subscriptions NEW Professional Tools to build applications and XML Web services for Windows and the WebTools to build applications and XML Web services for Windows and the Web MSDN Professional $1199 new $899 renewal/upgrade MSDN Enterprise $2199 new $1599 renewal/upgrade MSDN Universal $2799 new $2299 renewal/upgrade Enterprise Developer Enterprise lifecycle toolsEnterprise lifecycle tools Team development supportTeam development support Windows Server 2003 and SQL Server™Windows Server 2003 and SQL Server™ Enterprise Architect Software and data modelingSoftware and data modeling Enterprise templatesEnterprise templates Architectural guidanceArchitectural guidance
52
Microsoft Press ® Essential Resources for Developers Microsoft Visual Studio.NET is here! This is your chance to start building the next big thing. Develop your.NET skills, increase your productivity with.NET books from Microsoft Press www.microsoft.com/mspress
53
Become a Microsoft Certified Solution Developer What is MCSD? What is MCSD? Premium certification for professionals who design and develop custom business solutions How do I attain MCSD certification? How do I attain MCSD certification? Certification requires passing four exams to prove competency with Microsoft solution architecture, desktop applications, distributed application development, and development tools Where do I get more information? Where do I get more information? For more information about certification requirements, exams, and training options, visit www.microsoft.com/mcp
54
THANK YOU
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.