Loading dotConnect through reflection

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Adam
Posts: 2
Joined: Fri 14 Jan 2011 17:12

Loading dotConnect through reflection

Post by Adam » Fri 14 Jan 2011 17:23

Hi,

Is it possible to use the dotConnect libraries as an embedded resource and then load them using reflection? I have an implementation of our software using this method and it works great on my development machine. On other machines however I am getting an exception saying Devart.Data.dll cannot be found.

Our software will run in an environment where DLLs are not permitted and where we cannot install dotConnect. We've already attempted using ILMerge to combine the DLLs but this is incompatible with your licensing mechanism.

Kind regards,

Adam

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

Post by Shalex » Mon 17 Jan 2011 16:15

Using ILMerge
It is possible to use ILMerge.exe with the Devart.* assemblies starting from the 5.70.180 version of dotConnect for Oracle (this version includes fix for generating license resource for the ILMerged assembly).
Here is an example of a correct approach with ILMerge.exe (Result.exe - result assembly with MyApp.exe, Devart.Data.dll, and Devart.Data.Oracle.dll):
1) ilmerge Result.exe without any license resources (MyApp.exe does not require the license resource as well):
ILMerge.exe /out:"Result.exe" /log /allowDup:ExtensionAttribute "MyApp.exe" "Devart.Data.dll" "Devart.Data.Oracle.dll" /allowDup:DotfuscatorAttribute /targetplatform:v4,%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\
2) generate the license resource manually for Result.exe. licenses.licx content is "Devart.Data.Oracle.OracleConnection, Result" (without quotes). Command for generating license resource:
lc.exe /target:Result.exe /complist:licenses.licx /i:"Result.exe"
3) add the generated license resource to the MyApp project as an embedded resource, rebuild the project. Ilmerge the Result.exe again:
ILMerge.exe /out:"Result.exe" /log /allowDup:ExtensionAttribute "MyApp.exe" "Devart.Data.dll" "Devart.Data.Oracle.dll" /allowDup:DotfuscatorAttribute /targetplatform:v4,%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\

For more information, refer to http://www.devart.com/dotconnect/oracle ... nsing.html and ILMerge documentation.

Using reflection
It also should be possible. If you encounter any difficulties, please send us your test project and describe the problem you have encountered. Also specify your current version of dotConnect for Oracle (x.xx.xx).

Adam
Posts: 2
Joined: Fri 14 Jan 2011 17:12

Post by Adam » Tue 18 Jan 2011 11:00

Thanks. That looks like it has resolved our DLL issue.

Can I query some of the behaviour of dotConnect? In our deployment environment we also have restrictions in place on access to the registry. We're using dotConnect for Oracle in direct mode only so the libraries shouldn't need registry access. However, it appears dotConnect always checks the registry to see which Oracle homes are available even in direct mode. Is this the intended behaviour?

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

Post by Shalex » Tue 18 Jan 2011 15:32

Adam wrote:Can I query some of the behaviour of dotConnect? In our deployment environment we also have restrictions in place on access to the registry. We're using dotConnect for Oracle in direct mode only so the libraries shouldn't need registry access. However, it appears dotConnect always checks the registry to see which Oracle homes are available even in direct mode. Is this the intended behaviour?
dotConnect for Oracle shouldn't look for Oracle Client in the Direct mode. Please make sure that your application has a valid license resource as it is described in our documentation. If application is not licensed, license validator can look into registry to check if dotConnect for Oracle is installed (an alternative to embedding license resource).

If this doesn't help, please specify the exact text of the error, your call stack, and the version of your dotConnect for Oracle (the Tools > Oracle > About menu of VS).

Post Reply