Hi StanislavK,
thanks for the answer.
StanislavK wrote:- what is the GetUtenteCompletoById method (e.g., a wrapper for a stored procedure returning a result set, or a manually implemented method that executes a LINQ query);
as you understood, GetUtenteCompletoById method is a
wrapper for a
stored procedure returning a result set;
StanislavK wrote:- what exactly is the DebuggerWriter class, and whether the issue can be reproduced if it is not used;
to display Sql code in Debugger output window i have used DebuggerWriter class that is a
wrapper around Sytem.Diagnostics.Debugger; but this
not compromise the problem result (i could also to comment it);
StanislavK wrote:- how exactly are you creating multiple DataContext instances (e.g., can it be a simple loop?).
i am sure that is
not a loop because i see with Memory Profiler that some instances of DataContext
are Disposed but not Collected.
In attach, there is a screenshot of .NET Memory Profiler' comparison snapshot, in which MerqurioDataContext (which is a DataContext 's wrapper used as showed) has 999 instances that have been disposed but are still not GCed.
StanislavK wrote:If possible, please
send us a small test project.
My project is not small and send a little part of it'll not be relavant.
But i can explain how i access to database data (using Devart DataContext).
In my UI Layer i call my Business Layer that implement database interface using Devart dotConnect for my SQL Entity Model.
The way i call this Layer is using by DDD Model (Presenter-Service-Repository). In the Repository Layer there is a call to a method (example) that return a result set of utente_completo type (utente_completo is a view of my DB mapped by Entity Developer as result set of StoreProcedure GetUtenteCompletoById)
luigisaggese wrote:Code: Select all
utente_completo IUtenteRepository.GetUtenteCompletoById(Int32 pIdUtente)
{
utente_completo result = new utente_completo();
using (MerqurioDataContext dc = conn.GetContext())
{
result = dc.GetUtenteCompletoById(pIdUtente).FirstOrDefault();
}
return result;
}
We always use "using statement" in all invoked method of Repository layer.
Please note we have used a single DataContext for all DB knowledge (~200 Stored Procedure, ~20 View, ~100 Table...) and reading some discussions i have noticed
that it is better to use a multiple DataContext(ideally per business object) than single DataContext, as i have seen in:
http://stackoverflow.com/questions/2261 ... atacontext
-What do you suggest with single or multiple Devart DataContext? There are particular optimizations that i could use?
Thanks in advance,
LS