Creating a Custom BuildProvider in ASP.NET 2.0
page 1 of 6
Published: 18 Jan 2007
Abstract
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
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 47922/ 257

Introduction

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: 12/13/2010 11:38:11 PM
Comment:
very nicce aticle and i read alwas article
Title: DAL Build Providers   
Name: Thomsen
Date: 11/17/2009 2:59:36 AM
Comment:
Here an example of how you can create DAL with ASP.NET Build Providers:

1. http://www.codeproject.com/KB/aspnet/DALComp.aspx

2. http://jbaurle.wordpress.com/2007/07/24/creating-dal-components-using-custom-aspnet-build-providers-and-compiler-techniques/

Thomsen
Title: Excellent   
Name: shahfein Khan
Date: 9/1/2008 10:26:46 AM
Comment:
each and every point is covered very neatly.
Title: About BuildProvide   
Name: Mike Klok
Date: 6/18/2008 5:00:18 AM
Comment:
Hi very good article
Title: About BuildProvide   
Name: tonyduan
Date: 4/20/2008 11:30:29 PM
Comment:
Hi,
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: 1/23/2007 6:04:50 AM
Comment:
Hi, This is very good article.






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


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 7/28/2014 8:33:09 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search