Pre-generating proxies for NHibernate 3.x? - nhibernate

Is it possible to pre-generate lazy-loading proxies under NHibernate 3?
NHibernate 2 supported this via NHPG but NHPG hasn't been updated for NH3 that I can see. Downloading the NHPG sources and blindly changing the assembly reference from NH2 to NH3 blows up; NH3 has built-in proxy generation and stuff has been reorganized.
How are people (pre) generating lazy proxies under NH3?

I've updated NHPG to support NHibernate 3.3.1 GA.
You could grab the sources here: https://github.com/NHibernate-Contrib/NHibernate.ProxyGenerators
You have to build it by hands (download the sources and run package.cmd) for now until we release an official version.

I don't know if this answers your question since I do not see any tag related to language that you are using.
In .NET, I use Fluent NHibernate and POCO objects. Don't know if there is a tool to upgrade your XML files to POCO classes to use with Fluent NHibernate.

Related

Solrnet, StructureMap and NHibernate

I'm having a problem integrating a library our company has built which uses Solrnet in the back end. We have many other libraries, one of which uses NHibernate for the database. It all works fine, the library gets the data back.
When we add a reference to this new library which uses Solrnet, things start to go arwy. The first error that occurs when we run the application. when the application runs the StructureMap registry for the library using NHibernate, the registry blows up because NHibernate can't load the Castle.Core assembly (which has not caused any problems being missing prior to adding the reference). If we then ensure that Castle.Core is present, NHibernate then blows up trying to load Castle.Windsor, which again it didn't need before.
Any ideas? As I said, the library which uses NHibernate is fine if we remove the new library which uses Solrnet, but as soon as we reference it things start to go wrong. The library which uses Solrnet also configures Solrnet using StructureMap, FWIW.
EDIT: These are the versions of various assemblies in the mix.
StructureMap - 2.6.1.0
Fluent NHibernate - 1.0.0.0
NHibernate - 2.1.2.4000
Solrnet - 0.3.1.0
Castle.Core (came with NH) - 1.1.0.0
UPDATE: Its starting to look like Solrnet is the one trying to load Castle.Windsor. I'm not sure why as we've given it a StructureMap configuartion. Its mere presence is enough to blow things up. Even without the assemblies which depend on Solrnet, the fact that its there at all seems to mess with the NHibernate configuration.
Ok, I figured out how to stop this error. We were using the merged Solrnet.dll, which includes all the types for connecting to other Ioc containers as well as NH integration. I switched to using the unmerged binaries, which keeps the other Iocs in separate assemblies, and we only included the base Solrnet.dll and StructureMap.Solrnet.dll, which solved the issues mostly. I still did have to be sure to include Microsoft.Patterns.ServiceLocater, as the base Solrnet.dll still exposes this. Not ideal as we're not using it, but better than needing a bunch of other assemblies.

Interoperable Fluent NHibernate + NHibernate + Linq To NHibernate

I would like to get all 3 of these libraries working together but have a version problem.
Latest version of Linq To Hibernate (1.0) came out on 2009-07-26 and works with NHibernate 2.1.0 afaik. Fluent NHibernate's oldest release on the other hand is for NHibernate 2.1.2.
Google search yielded this zip file of binaries compiled together but it's somewhat outdated (2009-07-19). I'm not sure downloading the latest source code of each project and trying to build them together will work or not, I'd rather not to go that way unless I have to.
I guess the weakest link in this combination is Linq To NHibernate and maybe I should think of leaving it outside if there isn't an active community effort.
In short: Does anyone use these libraries together and if so, how did you solve this issue? Do you build it all yourself?
Note:
Looks like a duplicate of this question but it has been 1 year since it's answered, and the links given in the accepted answer don't work anymore.
NHibernate ver 3 has been released which already has the linq libraries. Download the latest binaries.
I don't think Fluent has been updated to use 3 yet so download the latest source for fluent and replace the NHibernate assemblies with the new NHibernate version 3 assemblies. You will need to tweak the source ever so slightly so that it compiles. Compile it in release mode and grab the output from the project bin folder.
It has been working fine for us.
EDIT
As Kohan pointed out you can download the latest version of Fluent 1.2 with the latest version of NHibernate 3 from the link to Fluent NHibernate I provided earlier.

Fluent NHibernate with NHibernate 3.0

With NHibernate 3 going GA today, I was wondering if I can upgrade a project that is using Fluent NHibernate. Can i simply swap out the 2.1 DLL for the 3.0 and have it work? - Or is there more to it than that?
I know there will be some work with the change in Linq syntax but i am not concerned with that, I just want to know if the DLLs are interchangeable for Fluent.
Many thanks,
Kohan
Addendum
The Fluent guys have done it themselves now:
http://fluentnhibernate.org/downloads
drlongnecker has built Fluent NHibernate for NHibernate 3.0GA. You can grab the source here.
Update: Fluent Nhibernate now officially builds pre-release binaries with NHibernate 3.0.
You need to build them together. Can wait for NuGet to be updated or you can build them yourself.
Or you can put assembly redirect

Fluent Nhibernate and Nhibernate 2.1.0.1003

Im experiencing some frustration trying to upgrade the nhibernate libraries that Fluent NHibernate uses.
Im also using Nhibernate.Linq and am wanting to use NHibernate.Validator, specifically the ValidationDef class.
Now Nhibernate.Validator is up to using Nhibernate 2.1.0.1003, and when i try to build FluentNhibernate against this verion it get some test errors.
It has to do with SessionFactory configuration and the newish Nhibernate.ByteCode.Castle library.
Could anyone help me out here?
I don't think FNH "officially" supports NHibernate 2.1 and probably won't until after it is actually released. However, it's my understanding that it is possible to get it to work. See if this thread on the FNH groups is helpful.

How do I get access to Castle Windsor's Fluent Interfaces API?

I've been having tons of problems getting the non-xml configuration for Castle Windsor set up working properly. In the meantime I've seen more and more people giving advice via the Windsor Container fluent interface. I've been Gooogling about for the last day and I cannot find this API anywhere.
I am talking about the key .Register() method which seems to be an extension method to the IWindsorContainer object. It seems like it might be in the Castle.MicroKernel.Registration namespace, but I cannot find the corresponding library anywhere!
Also, is there any place where I can find documentation for this stuff?
EDIT:
I found that the copy of Castle.MicroKernel in the sample project here has more namespaces then the one I was using (even though this one is eight days older and v1.0.0 whereas mine is v1.0.3...), still having trouble finding the .Register() method or any samples though.
EDIT:
I found some fluent interface samples at Bitter Coder, no downloadable samples though so I'm still at a loss.
Edit Again: Finally got it. The most recent source code for castle windsor is available here, get the most recent successful build, inside the zip file is a bin directory. The fluent interface is inside Castle.Microkernel (you will probably need to reference Castle.Dynaproxy, Castle.Dynaproxy2 and Castle.Windsor too).
PS This post is the #1 Google result for "castle fluent interface documentation" sad guys, you need to get on that. Crickets chirp What's that? Fine. Let me figure this out then I'll get on it then.
The Fluent interfaces were introduced a while ago - but are only available on Trunk (after RC3) either grab the castles sources (from the projects subversion repository) and build the IoC projects yourself from here, or easier still grab the latest successful build on the continuous integration server and use that.
Castle.MicroKernel.Registration is the name space you'll need to use, in the MicroKernel assembly - once you have a reasonably fresh build of Castle you should be able to find Register(...) methods on both IKernel and IWindsorContainer interfaces, allowing the application of "registration components" (anything which implements IRegistration) which includes the various fluent component registration features in Castle, as well as anything custom you might develop.
The best place to ask questions regarding Castle is the google castle-project-users and castle-project-devel groups - keep an eye out for Craig Neuwirt in particular as he's the core developer working on the fluent interface features in Castle Windsor, and so is best equipped to answer questions about the various fluent interface features, as they are not widely documented yet.
Ok, so just for reference. Official, complete documentation for the API is on Castle Windsor Documentation Wiki