Table of Content
- Architecture and Technology
- Installation guide
- Database tables
- Purpose of the application
- How to use ( instruction )
I started this project for fun and to get some experience using most of the recent technologies in one application. I have enjoyed developing it and hope you enjoy reading about it and using it…
Architecture and Technology
The Directory project is a simple application which has been designed using n-tire application architecture (see figure below). The application was developed in the .NET platform utilizing C#, Framework 3.5, LINQ to Entity with lambda expression, WCF, asp.net update panel, and AJAX controls.
VS 2008, Framework 3.5 , SQL server.
- Unzip the attached file
- Create a database in SQL server called “Directory”
- Run the DirecotryDatabaseTables.sql against this database to create all the required tables. You can find this file in the attached zip in the folder called DatabaseTables
- Open the IIS manager (open Run and type in “inetmgr” or the hard way!! Go to control panel -> Administration Tool -> IIS Manager if you are running Vista! Otherwise good luck finding it)
- Create a new Application Pool or a Virtual Directory called “Directory” and point that to the Web folder of the application
- Open the application in VS 2008 and update the connection string in the web.config
- Update data source ( if database is not in your local pc )
- User Id and password
Connection string in webconfig file:
<add name="DirectoryEntities" connectionString="metadata=res://*/DirectoryModel.csdl|
provider connection string="
Data Source=localhost;Initial Catalog=Directory;
Persist Security Info=True;
Purpose of the application
It allows the user to create different categories of THINGS eg: contacts, books, code and etc and store them in the database. It also provides two different search engines that can be used to retrieve the stored information and display them on screen.
There are only four tables which are involved in this application.
How to use:
To understand how this application works I would like to suggest you follow the example below. These instructions will help you to create some records in the database and let you use the search screen to retrieve those records and display them on the screen.
Once you have done the configuration and started running the application you will be presented with the following screen:
Open this window by clicking on the OPEN FOLDER icon from the main page.
In the first tab enter a name for the new category and click Create. The description is optional.
Enter the following information: Famous People
Choose the second tab (Subcategory) - and enter a name for subcategory and click Create. The description is optional.
Enter the following information: New Zealand
Choose the last tab (Subject) and enter the following information:
Name: Peter Jackson
Content: Director of the Lord of the Rings
peter, Jackson, Peter Jackson, New Zealander</em />
Name: Helen Clark
Content: Leader of New Zealand for 9 years
Helen, Leader NZ, New Zealander</em />
Close the maintenance window. Now you can search for above information using the search engine on the main screen.
You can browse the source code in the attach zip file but I would like to point out some of interesting and important sections of this application.
In the main page I used the AJAX CascadingDropDown control in conjunction with WCF to load the Categories.
<dropdownlist id="DropDownLisCategory" autopostback="true" onselectedindexchanged="
OnSelectDropDownCategoryChanged" cssclass="dropdownSmall" runat="server" />
<cascadingdropdown id="CascadingDropDown1" runat="server"
loadingtext="[Loading categories...]" prompttext="
Please select a category" category="Category" />
Following code shows how to include the WCF to the script manager tag.
<asp:ScriptManager ID="scriptMgr" runat="server">
<asp:ServiceReference Path="~/Services/DirectoryService.svc" />
The WCF files in this project: LINQ to Entity
Certainly the LINQ is one of the most interesting technologies around but it would be more popular if it worked with Oracle or …
Example code1: This method checks whether the category name, which is passed as a parameter, already being used.
private DirectoryEntities _directoryEntities = new <cod />DirectoryEntities();
public bool DoesCategoryNameExist(string name)
int result = 0;
ObjectQuery<category /> q = _directoryEntities.Category;
result = q.Count(sub => sub.Name == name);
catch (Exception ex)
return (result == 0) ? false : true;
Example code2: The mehod below create a new category in the database.
public void AddCategory(Category category)
catch (Exception ex)