EDML designer class code analysis violation
Posted: Tue 09 Oct 2012 18:40
The EDML designer class generated from an Oracle 11g database doesn't dispose of EntityCommand instances. Every time I regenerate the model, I have to manually wrap the generated code in every single method with "Using" statements, otherwise the class fails a rule in Microsoft's static code analysis tool.
The designer class gets generated with lines like this:
And I need to change them to something like this:
The code analysis rule that is violated is:
Microsoft.Reliability, CA2000: Dispose objects before losing scope
"call System.IDisposable.Dispose on object 'command' before all references to it are out of scope."
I tested this with the following versions of Devart dotConnect for Oracle:
-6.10.121
-6.80.350
-7.2.96
The problem is easy to reproduce; just drag a PL/SQL procedure on to the model, and take a look at the generated method in the designer class.
It would be fantastic if this deficiency was remedied in a future version of dotConnect.
The designer class gets generated with lines like this:
Code: Select all
Dim command As EntityCommand = New EntityCommand()Code: Select all
Using command As EntityCommand = New EntityCommand()Microsoft.Reliability, CA2000: Dispose objects before losing scope
"call System.IDisposable.Dispose on object 'command' before all references to it are out of scope."
I tested this with the following versions of Devart dotConnect for Oracle:
-6.10.121
-6.80.350
-7.2.96
The problem is easy to reproduce; just drag a PL/SQL procedure on to the model, and take a look at the generated method in the designer class.
It would be fantastic if this deficiency was remedied in a future version of dotConnect.