EDML designer class code analysis violation

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
sniperpon
Posts: 1
Joined: Tue 09 Oct 2012 18:02

EDML designer class code analysis violation

Post by sniperpon » 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:

Code: Select all

Dim command As EntityCommand = New EntityCommand()
And I need to change them to something like this:

Code: Select all

Using command As EntityCommand = New EntityCommand()
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. 8)

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDML designer class code analysis violation

Post by Shalex » Mon 15 Oct 2012 15:03

Thank you for your report. We will post here when the issue is fixed.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDML designer class code analysis violation

Post by Shalex » Wed 17 Oct 2012 09:26

The bug with disposing EntityCommand in the code generated for calling stored procedure is fixed. We will post here when the corresponding build of dotConnect for Oracle is available for download.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: EDML designer class code analysis violation

Post by Shalex » Thu 18 Oct 2012 16:24

New build of dotConnect for Oracle 7.2.104 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=1&t=25100.

Post Reply