.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Database scope

3 REPLIES 3
Reply
Message 1 of 4
Dale.Bartlett
186 Views, 3 Replies

Database scope

Hi All, I have a large application with many dozens of separate functions - DrawBuilding containing DrawLine/Circle etc. What is the best technique for scope of the database "db as New Database(False, True)"? It seems like a lot of duplication and overhead to create/save/dispose a database in each function, but I'm adverse to making Global. I am wondering about passing it as a parameter to each routine. The samples don't seem to show this type of structure, but I am sure my situation is very common. Thanks. Dale.



______________
Yes, I'm Satoshi.
3 REPLIES 3
Message 2 of 4

you should only use the New constructor if you plan on reading a database from a file, or actually creating a new one.



Otherwise you get a reference to the appropriate database from the appropriate document object.



I like to hold open a shared reference to the DocumentManager, and use it to retrieve my document and/or database references.
Dave O.                                                                  Sig-Logos32.png
Message 3 of 4
Anonymous
in reply to: Dale.Bartlett

{quote}

but I'm adverse
to making Global

{quote}

The architects of .NET were also adverse
to 'Global' variables, which is why there is no such thing as 'global' variables
in .NET.

Perhaps your confusion stems from the fact that VB.NET modules
are implicitly classes, and that any variables that are declared at the module
level (e.g., outside of a sub/function) are members of the class, rather than
variables having global scope.

It seems that you might need to get a
better undertstanding of variable scope.

--


http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
2009
Supporting AutoCAD 2000 through
2009
http://www.acadxtabs.com

Introducing AcadXTabs
2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


<dbartlett>
wrote in message news:6088727@discussion.autodesk.com...
Hi All, I have a
large application with many dozens of separate functions - DrawBuilding
containing DrawLine/Circle etc. What is the best technique for scope of the
database "db as New Database(False, True)"? It seems like a lot of duplication
and overhead to create/save/dispose a database in each function, but I'm adverse
to making Global. I am wondering about passing it as a parameter to each
routine. The samples don't seem to show this type of structure, but I am sure my
situation is very common. Thanks. Dale.
Message 4 of 4

Hi, Firstly I am using RealDWG to create a new database/dwg, so the "New" etc is all ok. Secondly re variable scope: yes my terminology is wrong. I have several classes which all handle different parts of the construction of the single dwg result, so my database needs to be passed between these classes. Thanks, Dale



______________
Yes, I'm Satoshi.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost