I had a go, and it wasn't all that difficult. I've uploaded the files that I
changed from FirebirdClient-2.1.0.0 Beta1 (which was the version I had)
here:

http://codeka.com/tmp/fb-beta1-updated-files.zip

The main interesting thing is IFbClient.cs and FbClientFactory.cs. IFbClient
is a new interface that basically just includes all the methods from the old
FbClient. FbClientFactory takes the name of the DLL in its only public
method (GetFbClient) and dynamically generates a class that implements
IFbClient.

All the other changes were basically so that instead of using a static
FbClient class, it called the methods through an IFbClient interface.

Another advantage of this method is that if, in the unlikely event that one
of the native functions changes, you can just modify IFbClient.cs with the
new definition and the FbClientFactory will update the dynamic class
accordingly.

Now, I haven't really tested it much (basically just dropped it into our own
project to check that it still works) so you might like to do some more
testing first. I also didn't write any unit tests, but that should be easy
enough...

Finally, when DEBUG is defined (i.e. in debug builds) my code writes the
generated assembly to disk (as DynamicAssembly.dll) so that you can load it
up in Reflector (or ildasm) and see what it generated. Release mode does not
do this.

Dean.



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to