Confusion About Assemblies - Ownership and Initialisation

  • Thread starter Thread starter Kevin Frey
  • Start date Start date
K

Kevin Frey

I have an ASP.NET application that references an Assembly called Model. This
assembly contains model-centric classes for dealing with database
operations.

The Model assembly contains a lot of classes which are derived from
base-classes in another assembly called DataAccess.

The ASP.NET application also references the DataAccess assembly, since it
sometimes carries out operations generically on the base classes.

So the references look like this (need a monospaced font to see this
properly):


+-----------------+ +-------------------+
| ASP.NET App |----------------| Model Assmbly |
+-----------------+ +-------------------+
| |
| |
| |
+-----------------+ |
| DataAccess | |
| Assmbly |-------------------------+
+-----------------+


The Model Assembly and the DataAccess assembly need to be "Initialised" via
an Initialise method.

So my questions are:

1. Is the ASP.NET App and the Model Assembly seeing the same instance of the
DataAccess assembly?

2. If my Model assembly initialises the DataAccess assembly, does the
ASP.NET app have to initialise it also (given Qu.1 above)?

Thanks

Kevin
 
1. Is the ASP.NET App and the Model Assembly seeing the same instance
of the DataAccess assembly?

Dll's are loaded only once per application - but you do not have to
worry about that.

2. If my Model assembly initialises the DataAccess assembly, does the
ASP.NET app have to initialise it also (given Qu.1 above)?

You never instantiate an assembly - only classes in this assembly. For
those, the same rules apply, if you use them in the same assembly. So
easy spoken for every "new myObject()" a new instance of a class is created.

Markus
 
My assembly needs to be initialised by calling a static member function of a
class inside that assembly.

The assembly is a .NET Wrapper written in C++/CLI, surrounding native C++
code. The initialisation process initialises things like our tracing
sub-system and other related stuff.
 
Back
Top