You need to write the driver too... Start by inheriting DriverBase. Diego
On Thu, Jun 10, 2010 at 16:02, Jackie Gleason <[email protected]>wrote: > Right I understand all of that (and of course I will share) but once I > create that how do I tell the driver to use that class as the connector > instead of the ASAConnection? Like what do I put in the driver tag of my > hibernate config. > > Thanks for the help! > > Jackie > > > On Thu, Jun 10, 2010 at 2:33 PM, José F. Romaniello < > [email protected]> wrote: > >> maybe you don't need proxy at all, what if you write : >> >> public class MyAsaConnection : SAConnection, IDbConnection ? >> >> I read proxy and start to write dynamic proxies, don't know why. >> >> 2010/6/10 José F. Romaniello <[email protected]> >> >> 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]<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]<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.
