Archive for October, 2008

Version is Out!

Friday, October 24th, 2008

Ok I’ll admit that it’s a bit later than I would have liked, but the next version of NHibernate.Remote is out.  While I’m sure that you’d like to read a lengthy article about blah this, blah that, and how hard it was with all of the other demands at work; I just don’t feel like writing all that out here.  So let’s just start of with a list of things that have changed.

  • Linq queries are now supported
  • Criteria queries are now supported
  • All new enities can now be saved
  • Entities on the client are change tracked and the changes are automatically submitted with a flush
  • Many more methods of ISession are now working
  • Better session concurrency

However there are still things that are being worked on, most noteably.

  • Transactions
  • Filters
  • Named queries
  • Sql queries
  • Change tracking on collections
  • Attatching transient entities

For a more complete list check out the documentation.

The underlying mechanisms have changed and evolved considerably since the last version.  However bear in mind that because of the vast number of entity combinations and queries, I haven’t had a chance to write tests for every senario, especially the more complex ones.

If you are adventuresome, grab the binaries or the sample project from the downloads page and give it a try. This version requires NHibernate 2.0.1GA and if you are using the binaries only, you will also need Post Sharp.

Forums are here

Thursday, October 23rd, 2008

Due to the number of comments that I have been getting on this blog and the emails that I have been receiving,  I have decided to setup a small forum for questions and comments.  Feel free to drop by and add your 2 cents on NHibernate.Remote, Generic Messaging or just anything in general.  I will try to answer any questions directed to me in a timely fashion (I hope).

Serialization bites again.

Thursday, October 9th, 2008

I’ve been back working on NHibernate.Remote for the last week since I finished some of the more urgent updates for the company where I’m working.  I’ve come to the sad realization that the path I’ve been treading with the initial NHibernate.Remote codebase just won’t cut it for several reasons.

1) NHibernate needs a session factory.  You just can’t operate remotely or locally without a session factory.  Initially my goal was to transfer the required factory information across the wire to the remote client. However this approach doesn’t work very well as SessionFactory information is deeply nested and not conducive to serialization.  So I’ve opted for the next best thing which is to create an identical session factory on both ends of the wire.  That way both the server and the client can be aware of Entities, Collections and Proxies.  The only thing that the remote session factory does not get is a connection string, so it cannot be used to open a direct database connection.  So far this has been working fairly well and has enabled me to get both Criteria queries and NHibernate.Linq queries working over the wire.

2) That was the good news, now for the bad news.  The remote client simply needs to be aware of the entities that it is holding.  That means that every time an entity or a collection comes in over the wire it needs to affect the persistence context.  If this can be implemented flushing the remote session will become much easier.  I thought that the ObjectGraphWalker that I had created would be up to this task but once again I appear to be mistaken.   One of the requirements  I need is that I need to be able to replace an entity as I walk the object graph.  Let me explain further.  In a local NHibernate session if you query an object, change some properties and then query that object again, NHibernate is smart enough to detect that it already has that entity and will return to you the original changed object.  I need to do that remotely, thus the requirement for substituting objects when I walk an incoming graph.  That is simply impractical with the way that the ObjectGraphWalker works.

So I’m back to needing custom access to the inner workings of a serializer. I’ve tried to hack my way into the NetDataContractSerializer but with little success.  Surely my requirement is neither original or unique and Microsoft would do well to provide more open access to their serialization techniques.  Most likely I’ll just have to use reflector to extract the functionality that I need.  Sigh.

Linq update

Wednesday, October 8th, 2008

About a week ago NHibernate 2.0.1GA was released, but I haven’t had a chance to compile NHibernate.Linq against it until now.  So if you are still looking to run the old version of NHibernate.Linq with NHibernate 2.0.1GA here are the files.

NHibernate.Linq for 2.0.1GA

I wasn’t sure that anyone was aware of this little project until I got a linkback from Ayende’s blog.

Of course I’m still waiting anxiously for the real Linq version that is being developed in the main trunk to mature as it looks like a far better stabler implementation.