Using C# 3.0 and .NET 3.5 ASP.NET

Dropthing’s business layer is built with the Windows Workflow Foundation (WF),which was introduced in .NET 3.0. Major operations like a first-time user visit, a subsequent user visit, adding a new widget, and creating a new page are all orchestrated using workflow.

The workflows contain all the business rules and activities needed to complete each operation. For example, the New User Visit workflow creates the user account, populates the user profile with default values, creates some default pages, populates them with specific widgets,etc.Such compound operations are very easy to build with workflows,which enable you to break the complete operation into smaller chunks called Activities.

Each Activity does a very small amount of work.It talks to the data access layer and performs the task.The data access layer is built with .NET 3.5,using LINQ to SQL, which vastly simplifies the querying of databases from within your application code.

The web project and the widgets make good use of .NET 3.5 by using new functionality for lambda expressions,LINQ to SQL,and LINQ to XML.You will use LINQ queries to work with collections and database rows.Widgets make good use of LINQ to XML to consume XML from external data sources.

The application is built following a typical N-tier architecture where there’s a clear separation between the UI, business logic,and data (see Figure). For example:

Web layer

Consists of web pages,web services,resources (e.g.,graphics,CSS,Java Script, and .resx files),and configuration settings.

Business layer

Provides the entity classes, business rules, and middle-tier caching of data to reduce database roundtrips.

Data access layer

Encapsulates database access and provides an interface that is database and data source independent.It also provides object factories that create Entity classes out of database rows and vice versa.

Mapping technologies to the different layers

Mapping technologies to the different layers

The web portal application in this book makes use of some of the newest .NET 3.0 and .NET 3.5 technologies.The web layer uses ASP.NET AJAX for a rich user experience, and the business layer uses the new WF to orchestrate complex operations. All three layers use LINQ to work with data structures.

C# 3.0 language extensions and LINQ queries are used in all layers to work easily with collections, database rows, and XML. WF is used in the business layer to perform complex operations, such as workflows.

LINQ to SQL is part of both the data access layer and the business layer Although the insert, update, and delete operations are mostly encapsulated inside the data access layer, some queries are faster to implement directly from the business layer. That’s why LINQ to SQL is also part of the business layer

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

ASP.NET Topics