Cowboy
Fri May 09 08:28:42 CDT 2008
"Willian Lopes" <willian@transespecialista.com.br> wrote in message
news:24477E8D-CE48-445F-8AEC-1487E0C4D4BE@microsoft.com...
>I know that DataSets are like a "copy" in memory from the database.
They are similar, in that they can hold much of the structure, but the
"database in memory" metaphor/analogy can get you into trouble if you cling
to all of the implications.
>So, there is a logic that I don´t understand: do I have to use a lot of
>DataSets?
There are two predominant theories here. The first is to create a DataSet
for each of the functions you use (or one that can span multiple functions).
For each operation, you may only have one DataSet going, but it leads to
many.
The other is to create one or more "master" DataSets and only fill the
tables you need to fill. You see this in some ORM products.
The direction you choose depends on how you wish to view your application(s)
more than how the application(s) actually work.
>If yes, when this DataSets will release theyre used memory?
Like any .NET object, a DataSet will mark itself as available for the
garbage collector when it is either a) explicitly destroyed or b) falls out
of scope. This is an oversimplification of course.
>If I used typed DataSets, when they update the database?
If you are continuing to reuse the DataSet, no. Some of the memory will be
"released", as the changes will have been committed (if coded correctly),
but as long as you are holding onto the reference, not all will be released.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it:
http://gregorybeamer.spaces.live.com/
*************************************************
| Think outside the box!
|
*************************************************