public class MyAsaConnectionProvider : DriverConnectionProvider
    {
        private static readonly ProxyGenerator proxyGenerator = new
ProxyGenerator();

        public override IDbConnection GetConnection()
        {
             var realDbConnection = new
SqlAnywhereConnection(ConnectionString);
             realDbConnection.Open();
return (IDbConnection)proxyGenerator.CreateInterfaceProxyWithTarget(typeof (
IDbConnection),

           realDbConnection,

           new MyDbConnectionWrapper());
      }
  }

Where ProxyGenerator comes from Castle DynamicProxy, and
MyDbConnectionWrapper is a class that implements IInterceptor
(dynamicproxy).

It goes without saying that if you make it work, you should share your
solution!

2010/6/10 Jackie Gleason <[email protected]>

> I had the same program to interface thought to. So anyone feel like showing
> me how I can make a proxy connection class and then have hibernate use that
> instead? Links are fine
>
> On Jun 10, 2010 1:53 PM, "Diego Mijelshon" <[email protected]> wrote:
>
> Actually, there's a historical reason for this: DbConnection was introduced
> in .NET 2.
> I guess MS wanted to keep the breaking changes separate...
>
>    Diego
>
>
>
>
> On Thu, Jun 10, 2010 at 14:28, Fabio Maulo <[email protected]> wrote:
> >
> > ah...
> > btw big kudo...
>
>  --
>
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post t...
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to