Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.1k stars 647 forks source link

Upgrade to latest nhibernate and fluent nhibernate #113

Closed andreasohlund closed 13 years ago

andreasohlund commented 13 years ago

On hold until FNH pushed a nuget that is compatible with NH 3.2

johannesg commented 13 years ago

I have a fork with NH 3.2 with FNH refactored out and using NH:s own automapping features instead if you're interested. It is not finished yet, but you can find it here if you want to take a look: https://github.com/johannesg/NServiceBus/tree/nh3.2

andreasohlund commented 13 years ago

I'm all for dropping FNH if the builtin NH mapping is good enough. I'll check the status with you before I do the upgrade

http://andreasohlund.net

http://twitter.com/andreasohlund

Date: Mon, 15 Aug 2011 22:50:15 -0700 From: reply@reply.github.com To: andreas_ohlund@hotmail.com Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

I have a fork with NH 3.2 with FNH refactored out and using NH:s own automapping features instead if you're interested. It is not finished yet, but you can find it here if you want to take a look: https://github.com/johannesg/NServiceBus/tree/nh3.2

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1813845

johannesg commented 13 years ago

Ok, I think I have something workable. All tests pass in the fork above. Some notes:

  1. Nuget is used to get the NH assemblies
  2. FluentNHibernate is removed and replaced with NH:s own "Mapping by Code" for automapping.
  3. NH 3.2 has it's own proxy generator now, which means that the default LinFu proxy is not needed anymore. So lots of configuration code (and a few tests) has been removed thanks to this.
  4. Since FNH is gone, I had to refactor lots of configuration code that previously used FNH for NH config.
  5. In the Azure projects, there is a dependency called "NHibernate.Drivers.Azure.TableStorage.dll" by @yvesgoeleven. It is dependent on FNH so I had to patch it and move the FNH dependency to a separate library. Yves, If you want I can send you a patch. The "Id hack" to add a partition key is refactored and moved to the sessionfactory builder in the NSB azure project.
  6. Regarding Azure, I have tried to make sure that the automapping does the same but since I don't use Azure myself I can't really test it.

Hope you like it. Just let me know if there are something that you don't like or want fixed. Or if you want a pull request.

/Johannes

andreasohlund commented 13 years ago

Yves: Do you see any reason to stick with FNH or would it be possible for you to remove the dep. in your driver for the table storage? /Andreas

http://andreasohlund.net

http://twitter.com/andreasohlund

Date: Tue, 16 Aug 2011 11:29:17 -0700 From: reply@reply.github.com To: andreas_ohlund@hotmail.com Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

Ok, I think I have something workable. All tests pass in the fork above. Some notes:

  1. Nuget is used to get the NH assemblies
  2. FluentNHibernate is removed and replaced with NH:s own "Mapping by Code" for automapping.
  3. NH 3.2 has it's own proxy generator now, which means that the default LinFu proxy is not needed anymore. So lots of configuration code (and a few tests) has been removed thanks to this.
  4. Since FNH is gone, I had to refactor lots of configuration code that previously used FNH for NH config.
  5. In the Azure projects, there is a dependency called "NHibernate.Drivers.Azure.TableStorage.dll" by @yvesgoeleven. It is dependent on FNH so I had to patch it and move the FNH dependency to a separate library. Yves, If you want I can send you a patch. The "Id hack" to add a partition key is refactored and moved to the sessionfactory builder in the NSB azure project.
  6. Regarding Azure, I have tried to make sure that the automapping does the same but since I don't use Azure myself I can't really test it.

Hope you like it. Just let me know if there are something that you don't like or want fixed. Or if you want a pull request.

/Johannes

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1818952

yvesgoeleven commented 13 years ago

No not really, the usage of it in the driver is really minimal.

I'm uploading johannes' build to azure right now, it works on my machine already. I expect no issues really...

andreasohlund commented 13 years ago

Sweet, I'll take a closer look at it.

http://andreasohlund.net

http://twitter.com/andreasohlund

Date: Tue, 16 Aug 2011 12:34:08 -0700 From: reply@reply.github.com To: andreas_ohlund@hotmail.com Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

No not really, the usage of it in the driver is really minimal.

I'm uploading johannes' build to azure right now, it works on my machine already. I expect no issues really...

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1819549

yvesgoeleven commented 13 years ago

Sorry, my bad, getting exceptions... index out of range exception, not sure why that is

johannesg commented 13 years ago

Can you get a stack trace?

2011/8/16 yvesgoeleven < reply@reply.github.com>

Sorry, my bad, getting exceptions... index out of range exception, not sure why that is

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1820069

yvesgoeleven commented 13 years ago

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.Collections.Generic.List`1.get_Item(Int32 index) at NHibernate.Drivers.Azure.TableStorage.TableStorageParameterCollection.GetParameter(Int32 index) in E:\Dev\Source\NHAzureDriver\Azure\TableStorage\Trunk\Infrastructure\Driver\TableStorageParameterCollection.cs:line 151 at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index) at NHibernate.Driver.DriverBase.ExpandQueryParameters(IDbCommand cmd, SqlString sqlString) at NHibernate.AdoNet.AbstractBatcher.ExpandQueryParameters(IDbCommand cmd, SqlString sqlString) at NHibernate.Loader.Loader.PrepareQueryCommand(QueryParameters queryParameters, Boolean scroll, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)

-----Original Message----- From: johannesg [mailto:reply@reply.github.com] Sent: dinsdag 16 augustus 2011 10:27 To: Goeleven, Yves Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

Can you get a stack trace?

2011/8/16 yvesgoeleven < reply@reply.github.com>

Sorry, my bad, getting exceptions... index out of range exception, not sure why that is

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-182 0069

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1820100

andreasohlund commented 13 years ago

What is the current status of this one Johannes?

johannesg commented 13 years ago

Yves made some changes in his tablestorage driver to work around changes(bugs?) in NH3 that triggered the above exception. I think he has not been able to test it yet though.

On the other hand, the problems that Yves have had seems to be specific to the Azure driver so if you want to try out the regular NH persister, go ahead!

andreasohlund commented 13 years ago

Ok, cool

yvesgoeleven commented 13 years ago

I've tested a couple of samples already and expect no major issues... so go ahead

There is indeed a bug in the NH3 source code for drivers that do not want to use named prefixes, but I guess every other driver is using them anyway (and so does my driver from now on)...

Let me know when you do it though, so that I can provide the correct version of the driver assembly...

-----Original Message----- From: johannesg [mailto:reply@reply.github.com] Sent: woensdag 31 augustus 2011 11:23 To: Goeleven, Yves Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

Yves made some changes in his tablestorage driver to work around changes(bugs?) in NH3 that triggered the above exception. I think he has not been able to test it yet though.

On the other hand, the problems that Yves have had seems to be specific to the Azure driver so if you want to try out the regular NH persister, go ahead!

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1955556

andreasohlund commented 13 years ago

Ok; Johannes: I have problems running the InMemory test (complains that it can't load nh 2.1.2??) Checked with dotPeek and the SagaPersister.Tests dll seems to be referencing 2 different versions of NH?? Do you have the same problem?

http://andreasohlund.net

http://twitter.com/andreasohlund

Date: Wed, 31 Aug 2011 02:47:43 -0700 From: reply@reply.github.com To: andreas_ohlund@hotmail.com Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

I've tested a couple of samples already and expect no major issues... so go ahead

There is indeed a bug in the NH3 source code for drivers that do not want to use named prefixes, but I guess every other driver is using them anyway (and so does my driver from now on)...

Let me know when you do it though, so that I can provide the correct version of the driver assembly...

-----Original Message----- From: johannesg [mailto:reply@reply.github.com] Sent: woensdag 31 augustus 2011 11:23 To: Goeleven, Yves Subject: Re: [NServiceBus] Upgrade to latest nhibernate and fluent nhibernate (#113)

Yves made some changes in his tablestorage driver to work around changes(bugs?) in NH3 that triggered the above exception. I think he has not been able to test it yet though.

On the other hand, the problems that Yves have had seems to be specific to the Azure driver so if you want to try out the regular NH persister, go ahead!

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1955556

Reply to this email directly or view it on GitHub: https://github.com/NServiceBus/NServiceBus/issues/113#issuecomment-1955728

andreasohlund commented 13 years ago

For get about it, got it working!

johannesg commented 13 years ago

Cool!