Re: Class Library Configuration Files



Peter,

That's exactly what you have to do. A windows service is just an EXE.
If you create an EXE in .NET that is run as a windows service, then you can
create a config file where you place all of your configuration settings.

I am definitely of the same mind as what Brian described, that because
it is a class library, you should be specifying in the EXE that calls the
class library what the configuration is. It's just a matter of knowing
where your configuration file is going to be.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx


"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
news:%23x4sz$TcHHA.2300@xxxxxxxxxxxxxxxxxxxxxxx

"Brian Gideon" <briangideon@xxxxxxxxx> wrote in message
news:1175087096.264674.289430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<snip />
There's another school of thought that says you should keep
configuration parameters out of the class library precisely because it
can be reused by multiple applications. Different applications might,
and often do, need to inject different parameters.

There are certainly cases where it makes sense to have a class libary
specific configuration file. I'm just not convinced this one of
them. And unfortunately I don't have an answer to your specific
question.

Brian


Thanks for that Brian.

Perhaps I should expand a bit. The configuration file is for the data
access component of an n-Tier application. It is a class library that is
called by another class library (the business logic layer component). The
business logic layer component is a remote component hosted in a Windows
service. Therefore the nearest executable is the Windows service.

The real executable is the one on the client machine (or, more likely, Web
server). One of the main points about n-Tier development is that the
client is completely unaware of implementation details in respect of
things like data accesss. It just wants the data. We might, for example,
decide to move away from SqlServer to MySql. Such a move should leave the
client entirely untouched. The last thing we would want to do would be to
pass a connection string to the remote object: it's one of the things
we're trying to keep off the client - especially if the client is a Web
server.

Whether or not configuration can be retrieved from the Windows service
AppConfig file, I don't know. I'll have to do some tests. It's not
great, though, doing it that way because it takes config away from the
thing you actually want to configure (the data access code).


Peter




.



Relevant Pages

  • Re: How do I give ASP.NET process network credentials?
    ... An error occurred during the processing of a configuration file ... required privilege is not held by the client. ... Error from the operating system 'A required privilege is ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Making a dynamically-linked root
    ... configuration data that you would typically store in a file. ... to be done on the client side or to the client protocol. ... remote services for particular configuration file classes, like NIS, ... different backend storage mechanisms such as databases, ...
    (freebsd-arch)
  • Re: Problems while using an ASP NET page as a remote client
    ... that's where it should generally go when running a web app. ... I cannot get my ASP NET app to work as a remote client to the data tier ... while reading remote configuration from a configuration file. ...
    (microsoft.public.dotnet.framework.remoting)
  • HELP: How to create different IPC channels in both server and client configuration file
    ... both my server and client will use ... to read configuration file ... Please advise what is the right way to create both client and server side ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: ATI or Nvidia?
    ... I don't like too much having these proprietary drivers "tainting" my ... Usage: aticonfig... ... Parses an existing X-Server configuration file and modifies it to operate ...
    (comp.os.linux.hardware)