Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:01:14+00:00 2026-06-12T00:01:14+00:00

I am already working on a .net project but I think this question can

  • 0

I am already working on a .net project but I think this question can apply to any programming language/framework.

The question is what are the good practices for reading configuration for a class library. I can think of the following options:

  1. Read from the application domain’s config file. For example in case of .net web app, read from web.config
  2. Read from specific custom file made for this class lib. Like create a xml file for your class lib and put your configuration there.
  3. The caller should pass the configuration needed to class lib (thru class constructor). So in this case class lib does not directly read from a configuration file but instead expects the caller to send the required information.

Any ideas/preferences?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:01:15+00:00Added an answer on June 12, 2026 at 12:01 am

    Surprisingly (or unsurprisingly?) it depends.

    From a developer’s point of view, having the caller supply configuration via library API is preferable because it allows the library to be used in a wider variety of contexts, not dependent on how the library is being hosted. Providing a configuration loader that can pull from app domain or a private file is gravy, and reasonably usable defaults if no configuration is performed are a sanity-saver.

    From an operator’s point of view, it is also useful to be able to override whatever settings a developer supplied because they don’t make sense in your environment. It’s not clear to me how this might work if the developer is deliberately trying to force the shape of the environment on you, though.

    I think the best compromise is to allow for all three possibilities, as log4net does.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a question about tidyness. The project is already working, I'm satisfied with
I'm working on a 2d engine. It already works quite good, but I keep
I am currently working on a WPF/.Net project, In this project the user has
I'm working with ASP.NET project where the user can upload files to the server.
I have a database table using an enum. This is already working with hibernate
I am working on a project that already has begun being developed. ON some
I'm working on getting my ASP.Net project working on Linux. I've been testing my
I'm admittedly favour DIV, but am working on a project that uses nested tables.
I am working on a .NET project, which needs to interact with some user
I'm working on a new asp.net mvc4 project using Visual Studio 2011 beta and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.