Confusion About Assemblies - Ownership and Initialisation

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
 
M

Markus

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
 
K

Kevin Frey

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top