Technical Reference

Employee Info Starter Kit v5.0 - ASP.NET Web Form Edition | All Versions and Editions

Release Home Page - Direct Download Link - Installation Walkthrough - Hand on Coding Walkthrough - Technical Reference

Technology Overview

Programming Languages/Scripts

  • Browser side: JavaScript
  • Web server side: C# 4.0
  • Code Generation Template: T-4 Template

UI Frameworks

  • JavaScript Framework: jQuery 1.5.1
  • CSS Framework: Grid 24

.Net Framework Components

  • .NET Entity Framework
  • .NET Optional/Named Parameters
  • .NET Tuple
  • .NET Extension Method
  • .NET Lambda Expressions
  • .NET Anonymous Type
  • .NET Query Expressions
  • .NET Automatically Implemented Properties
  • .NET LINQ
  • .NET Partial Classes
  • .NET Generic Type
  • .NET Nullable Type
  • ASP.NET Meta Description and Keyword Support
  • ASP.NET URL Routing
  • ASP.NET Grid View
  • ASP.NET Form View
  • ASP.NET Skin
  • ASP.NET Theme
  • ASP.NET Master Page
  • ASP.NET Object Data Source
  • ASP.NET Role Based Security

Architectural Overview

Introduction

This section explains the overall architecture of Employee Info Starter Kit, a web application that illustrate a wide range of architectural guidelines and samples to address different types of real world challenges faced by web application developers. This architecture reference and the starter kit will help you to gain solid understanding and hand on experience to build different application layers, such as presentation layer, business logic layer, data access layer - using latest ASP.NET 4.0, Entity Framework 4.0, SQL Server and Visual Studio 2010 based technologies.

User Requirement

The user end functionalities of this starter kit are pretty simple and straight forward that are focused in to perform CRUD operation on employee records as described below.

  • [C]reating A New Employee Record The users should be able to create new employee record, one at a single time.
  • [R]ead Existing Employee Record The users should be able to view the employee records in list style, where maximum 10 records can be visible per page and the list can be filtered out based on their supervisors. The user should also be able to view employee records with details, once at a single time and can print it in a printable format.
  • [U]pdate an Existing Employee Record The users should be able to update an existing employee record, one at a single time.
  • [D]elete an Existing Employee Record The users should be able to delete single or multiple employees at a time while viewing employee records in list style.

What is Architecture?

Software Architecture can be defined with two responsibilities.

  • First, it’s a standard. It provides a technical blueprint for software engineers, which needs to be followed as an implementation standard.
  • Second, it provides the best solution among different solution, with respect to application context (requirement, budget, constraints etc).

Architectural Objective

There is no universal architecture which can be considered as the best for all sorts of applications around the world. Based on requirements, constraints, environment, application architecture can differ from one to another. While creating this web application project architecture as an architecture reference, the following considerations were taken:

Simple Domain

The application functionality is focused to perform CRUD (Create, Read, Update, and Delete) operation on a single logical entity “Employee”. The underlying database contains only one database table which is taken from a very well-known reference database “Northwind”. The reason the “Employee” table has been considered, is, it contains different types of data fields (such as Sql Server int, nvarchar, datetime, image, ntext etc) along with both primary and foreign key reference in a single table. Learners can find this architecture reference useful without spending much time to understand system requirements.

Detailed Architecture

Although the user requirement and database design is pretty simple for this starter kit project, the overall architecture and implementation model covers a very wide range of software architecture practices, which can be considered an “EXTREME” example of what and how we can design and implement a system for a single entity to meet different types of architectural and system aspects. In real world software development, this much “effort” may not needed for each entities in the system, instead, different entities may deserve different “attention” most of which has been illustrated here.

RAD Implementation

One of the main application architecture design consideration of this project is RAD (Rapid Application Development) which is one of the most common approach around the world to fit budget in a limited timeline. However due to the nature of this software development strategy, RAD is mostly fitted for small to semi-medium sized projects. Thus the current application architecture may not be well fitted for complex and large application project.

ASP.NET Web Form and Entity Framework

The presentation layer is based on ASP.NET web form which provides different types of excellent RAD supported data bound controls. On the other hand for data access, Entity Framework 4.0 has been considered. ORM (Object Relational Mapping) has been popular in current trend of software development. Microsoft has invested significantly on its ORM product Entity Framework to consider it as its future recommended data access technology. Due to RAD architecture it has not been possible to get all sort of benefits of ORM, in current project, however using Entity Framework with ASP.NET web form is still worth to get benefitted.

T-4 Template

T-4 template, supported by Visual Studio, is an excellent tool that provides a great degree of productivity, especially in RAD strategy. Codes that are repeated but can be predefined can be generated from a template engine. For data driven application development, data models typically takes place to be used by code generators to generate intermediate layers. Code generation is also a good tool to ensure a specific standard been followed on source code easily. However it has been argued that code generation sometimes promotes bad architecture, which may be true for complex and large application development. On the other hand, .NET language features, such as partial class, partial method provides a great flexibility to design and follow good architecture.

Logical Layers

Data Access Layer

Responsible to handle data access code.

Business Logic Layer

Responsible to handle business logic code.

Presentation Layer

Responsible to handle presentation logic code.

Cross Cutting Data Behaviors

While logical layers provides a clean separation of concerns with respect to different responsibilities, a set of common behaviors considering data are required to be performed across the logical layer. Data Behaviors are typically implemented using C# method, Sql Server Stored Procedures. These common behaviors can be primarily divided into two categories:

Predefined Behaviors:

To gain higher productivity, it is often beneficial to utilize code generators to generate basic functionalities on logical layers that can be predefined. For an entity Employee in “Employee Info Starter Kit” project, the following data behaviors have been considered as Predefined behaviors:

  • Create a new record: creates a new employee and returns the newly generated primary key of the “just created” employee. 
  • Update record: Updates an existing employee
  • Delete a single record: deletes a single employee based on primary key
  • Delete a set of records: deletes a set of records, based on the passed parameter of list of Id's as xml data. Performing data operation over a batch of records is a good practice in terms of application performance (reduces database round-trip).
  • Get a single record by primary key : get by primary key
  • Get a set of records by foreign key : get by foreign key
  • Get a set of records by foreign key – in paged fashion: get by foreign key as paged result. Paging is one of the most important parts while dealing with large set of data to be shown in ASP.NET controls, like GridView.
  • Get the total count for a set of records by foreign key: get by foreign key as count method. ASP.NET ObjectDataSource control’s paging functionality also requires a count method, which will contains the number of total records to be used to form the paging functionality.
  • Get all records : get all records for that entity
  • Get all records – in paged fashion : get all records as paged result
  • Get the total count of all records : get all records as count method
Custom Behaviors:

Custom behaviors are the data behaviors that are specific to custom needs with respect to one or more data entities and can’t be generated using code generators. In Employee Info Starter Kit project, three custom data behaviors has been considered, which address some common data behavior that are required to be performed in typical software applications.

  • Get by filter parameters
  • Get joined query results
  • Get results as multiple result set

Code Generation Strategy

Model Based Code Generation: The current architecture is primarily focused on ORM style data modeling, based on which the data layers are constructed. Entity Framework 4.0 supports complex mapping from database to application level that enables developers to utilize application layers and data model in more object oriented approach, regardless of underlying data model in database. Based on the entity model, available through Entity Framework Designer, code for predefined behaviors can be generated automatically for the following logical layers, according to current software architecture:

  • Business Entities
  • Data Access Layer
  • Business Logic Layer

Model VS Database Driven Design

Since Entity Framework enables us start designing the system both from entity model and database, one key design consideration in current architecture is whether we need to consider model or database driven approach? One core benefit to consider model driven approach is we can start implementing and testing core business logic without any database, since Entity Framework provides a good support for isolation testing. With respect to current architecture, both approaches work fine; even hybrid approach can also be considered.

Cross Cutting Concerns

Which layer to perform the common concerns (validation, authorization, caching, exception management, logging and auditing)

Validation

Data validation in done in Employee Info Starter Kit in both presentation layer and business logic layer.

Exception Management

Exception handling is being happened in presentation layer only.

Logging

Logging is being handled in presentation layer only.

Security

Authentication and authorization is being handled in presentation layer only.

Last edited Mar 7, 2011 at 10:19 PM by joycsc, version 18

Comments

No comments yet.