Creating a Custom BuildProvider in ASP.NET 2.0
page 1 of 6
Published: 18 Jan 2007
In this article Bilal Haidar explains the usage of a BuildProvider in ASP.NET 2.0 and shows you how to create a custom BuildProvider to access an XML file in the form of a C# class at design time.
by Bilal Haidar
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 46572/ 56


Last week we were trying to generate some source code in the form of a C# class out of an XML file that contains some settings configuration at run time and yet, be able to have an intellisense at design time. This is all said and the .NET environment is .NET 1.1. After so much research in this field, we understood that what we are trying to do is a bit hard, but is still doable in .NET 1.1. The work around was to have some sort of an Interface that the generated class implements and, hence, a full access to all the configurations in the XML file through the dynamically generated class in C#. As a drawback you can easily see that, with the use of the Interface, every time we change the XML file we have to change the Interface and have a new build. Not feasible, but it does the job!

Until recently, we have posted on the ASP.NET forums about this issue and Scott Allen was there to refer to a post on Scott Guthrie’s blog that talks about BuildProviders in ASP.NET 2.0, which does exactly what we have been trying to do in the .NET 1.1 Framework.

In this article we will explain what a build provider is, how it is used by the ASP.NET 2.0 Web Application, refer you to some good links online about this topic, and, off course, show you how to create a custom BuildProvider to load an XML file into a C# class and access all the properties of that class at design time!

View Entire Article

User Comments

Title: DAL build provider   
Name: deepak nalwaysa
Date: 2010-12-13 11:38:11 PM
very nicce aticle and i read alwas article
Title: DAL Build Providers   
Name: Thomsen
Date: 2009-11-17 2:59:36 AM
Here an example of how you can create DAL with ASP.NET Build Providers:



Title: Excellent   
Name: shahfein Khan
Date: 2008-09-01 10:26:46 AM
each and every point is covered very neatly.
Title: About BuildProvide   
Name: Mike Klok
Date: 2008-06-18 5:00:18 AM
Hi very good article
Title: About BuildProvide   
Name: tonyduan
Date: 2008-04-20 11:30:29 PM
Your writing is very very pretty.
i have a question,where can find the cs file be generated,and can i place the class in a cs file i appointed?
Title: About BuildProvide   
Name: manish
Date: 2007-01-23 6:04:50 AM
Hi, This is very good article.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-04-13 9:32:30 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search