Creating an Application Development Framework Using Enterprise Templates - Part 3, Page 3
Disabling toolbox items
As we said in the beginning of this article, we want to standardize on SQL Server as the database of choice. Once we know that the database is SQL Server, we definitely want to take advantage of the high performance classes present in the System.Data.SqlClient namespace. Even though we have recommended the use of data access application block (that is included) as part of the development framework, sometimes the developers might want to add database related classes in their code. In that case, we don't want the developers to add the Oledb related classes (that are present in the namespace System.Data.Oledb) to the application. To prevent this, we will disable all of the oledb related toolbox items that are present under Toolbox->Data tab.
To perform this, we will open up the CustomDistributedAppTemplate.tdl file and add the following entries.
<DEFAULTSETTINGS> <DEFAULTACTION>INCLUDE</DEFAULTACTION> <ORDER>EXCLUDEINCLUDE</ORDER> <POLICYMODE>RESTRICTIVE</POLICYMODE> <CONSTRAINTS> <TOOLBOXCONSTRAINTS> <TOOLBOXCONSTRAINT> <ID>tboxDataOLEDbConnection</ID> <ENABLED>0</ENABLED> </TOOLBOXCONSTRAINT> <TOOLBOXCONSTRAINT> <ID>tboxDataOLEDbCommand</ID> <ENABLED>0</ENABLED> </TOOLBOXCONSTRAINT> <TOOLBOXCONSTRAINT> <ID>tboxDataOLEDbDataAdapter</ID> <ENABLED>0</ENABLED> </TOOLBOXCONSTRAINT> </TOOLBOXCONSTRAINTS> </CONSTRAINTS> </DEFAULTSETTINGS>
Now if you bring up the Data tab in toolbox, you will find that all the OleDb related components are disabled.
Putting It All Together
Now that we have constructed the different parts of the application, let us test our enterprise template by going to File->New Project and selecting Other Projects->Enterprise Template Projects. In the New Project dialog box, you will find CustomDistributedAppTemplate listed in the Templates pane.
In the above screenshot, when you enter a name for the project click OK, you will be prompted to enter the URL for the Web service.
Once you enter the URL and click OK, you will be prompted to enter the URL for the WebUI project as shown below.
Clicking OK on the above dialog box results in the template project being created and initialized. Once the project is created, if you bring up the solution explorer, you should see something similar to the following.
As you can see from the above screenshot, the template project, by default, provides developers with not only the desired application architecture, but also a clearly defined application development framework that comprises of a set of reusable components, architectural guidance, and best practices.