Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2006, 12:18 PM
MM MM is offline
Registered User
 
Join Date: Nov 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default configSection.cs and other bafflements

Hi folks,
Marco says on page 52 of his book that ArticleProvider (which is a base class to sqlArticleProvider has an Instance static method that
returns an actual instance of the correct class
"according to what's specified in the configuration file"

however I stepped through this and when I get to the Instance property:

           _instance = (ArticlesProvider)Activator.CreateInstance(
                  Type.GetType(Globals.Settings.Articles.ProviderTyp e));
            return _instance;
         }
      }


the Globals.Settings.Articles.ProviderType in the immediate window returns

"MB.TheBeerHouse.DAL.SqlClient.SqlArticlesProvider "

but this string isn't in any configuration file that I can find...it's in a class called ConfigSections in ConfigSections.cs in app_code folder

  [ConfigurationProperty("providerType", DefaultValue = "MB.TheBeerHouse.DAL.SqlClient.SqlArticlesProvider ")]
      public string ProviderType
      {
         get { return (string)base["providerType"]; }
         set { base["providerType"] = value; }
      }

is this a typo on Marco's behalf or is this fully qualified classname in a configuration file as well and I just can't find it

I understand the elegance of what he's trying to do with the abstract classes and separating the DAL from the BLL etc...it's just that I want to make sure that I'm not missing something as to exactly where this setting is stored...


Many thanks in advance for any clarifications,
Regards
MM

 
Old November 15th, 2006, 10:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

He plugged in a custom configuration provider via web.config. It's a cool idea.

It's a little overkill for a site like this, but he did it to teach us how its done.

 
Old November 16th, 2006, 06:45 PM
MM MM is offline
Registered User
 
Join Date: Nov 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for answering englere, but that was my exact question, as I can't find the string in the config file, because it's not there, but it is in the default value of the attribute in the class that inherits from configurationSection...any ideas?






Similar Threads
Thread Thread Starter Forum Replies Last Post
ConfigSection Muhammad Zeeshan BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 21st, 2008 02:29 PM
in web.config or ConfigSection.cs? jini BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 3rd, 2007 04:39 AM
ConfigSection Error - CS0029: Cannot implicitly co bigluzer BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 January 9th, 2007 12:37 AM
How to compile - First.cs gau404 BOOK: Professional C#, 2nd and 3rd Editions 1 November 14th, 2005 03:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.