Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,589
|
Comments: 51,218
Privacy Policy · Terms
filter by tags archive
time to read 1 min | 76 words

Well, here is the first of the goodies.

I have updated NQA to work against NHibernate 1.0.3, so anyone who upgraded can still use it. Please note that this is avialable for .Net 2.0 only.

The binaries are here, but the sources are not in the usual place, instead they are in the NHibernate 1.0.x branch here.

Have fun.

time to read 1 min | 145 words

Well, it is certainly an interesting release. This release contains very little code of mine, mainly minor adaptations of two wonderful patches that were sent to me.

  • The first by Bas Jansen - which added inheritance detection from the mapping files.
  • The second by Adam Tybor - which added support for projections and group by.

Me, I just fixed a stupid bug by yours truly that would refuse to recognize exe as valid assemies, and put those two patches together.

Together, they make quite an addition to NQG. Especially when combined with some thing that can really understand projections... which is soon to come.

You can get it here.

time to read 2 min | 268 words

I have updated NHibernate Generics to support NHibernate 1.2 . This update is very minimal and was done to ensure that you can move code to the NHibernate 1.2 without breaking stuff.

Please consider NHibernate Generics library use as deprecated with NHibernate 1.2 and above.

NHibernate Generics (NG from now on) always had two purposes. The first was to give generics capabilities to NHibernate, so I wouldn't have to do casts all over the place. The second was to automatically handle assoications between objects using anonymous delegates and a sprinkle of magic.

I wrote this library nearly a year ago, and I have learned a lot since then, not the least of which, I learned what is the cost of magic. There are design assumption built into the library that are now proven to be false, specifically, when you want/don't want to force lazy load and working with the second level cache.

When I find myself scratching my head and trying to understand what is happening in the code I know that it is doing too much behind my back.

We no longer need external Generics support, since it is now (1.2) built into NHibernate.  And I had a lot of fun and a number of serious issues with the automatica assoication handling, so I don't see much of a point in continuing that.

You can find the code here, just check out and compile, I am currently not planning to create a binary release.

time to read 10 min | 1856 words

So it has been out for 24 hours, and I got a couple of bug reports (fixed) and some interesting feedback. Ken is asking how you can extend the generated code and use SQL Functions from it. I had to fix a couple of issues which had to do with the amount of code I generated, right now I reduced the amount of code generated by 40% (with no affect of functionality, of course).

After those changes (which also include making everything partial, we can start extending the Where class, this turned out to be a fairly easy, check this out:

namespace Query

{

      public partial class Where

      {

            public partial class Root_Query_User

            {

                  public virtual QueryBuilder<User> IsInGroup(string groupName)

                  {

                        QueryBuilder<User> queryBuilder = new QueryBuilder<User>("this", null);

                        AbstractCriterion sql = Expression.Sql(
                                new SqlString("? in (select 'Administrators')"),
                                                       groupName, NHibernateUtil.String);

                        queryBuilder.AddCriterion(sql);

                        return queryBuilder;

                  }

            }

      }

}

 

This is a silly little expression, but it shows that you still have the power to extend the code to allows whatever you want, and still get very good OO syntax. We can now use this like this:

User.FindOne(Where.User.IsInGroup("Administrators"));

One thing to note, I explicitly extend Root_Query_User, this is because if I want to extend Query_User<T1>, I would need to make the criterion join-safe (in this case it is, but it is better to be safe) which can be quite hard.

Update: After applying Ken's suggestion (in the comments), it shrank to:

public partial class Where

{

      public partial class Root_Query_User

      {

            public virtual QueryBuilder<User> IsInGroup(string groupName)

            {

                  AbstractCriterion criterion = Expression.Sql("? in (select 'Administrators')",

                                                               groupName, NHibernateUtil.String);

                  return FromCriterion(criterion, "this", null);

            }

      }

}

Much cleaner, thanks Ken.

time to read 1 min | 120 words

Following the advice from the comments, I have managed to consolidate my various OSS SVN repositories into a single one, hosted at source forge.

I was quite suprised that it was so much, to tell you the truth.

The repository URL is:

https://svn.sourceforge.net/svnroot/rhino-tools/trunk/

To checkout, execute:

There is no password necceary for reads. I'll be update the various links on the site to point to the correct location soon.

time to read 1 min | 75 words

NQG will now automatically create the NamedExpression and ManyToOneNamedExpression files, in a language of your choice, so you basically point it at a directory, let it run, and then just include all the files in that directory.

You can get it here.

Update: I fixed the warning in the generated files, and gave it a name without spaces, so it wouldn't break on download.

time to read 1 min | 95 words

If you are using NHibernate.Generics with NHibernate 1.2, you may run into casting issues, this is because NHibernate.Generics and NHibernate 1.2 both tries to make the collections generic.

You can either stop using NHibernate.Generics (their main purpose, allowing generic collections in NHibernate) is no longer needed. But their secondary purpose, automatic syncronization between related properties is very nice in many scenarios. Until I'll get around to porting them to 1.2, you need to specify generic="false" in the mapping of all collections that uses NHibernate.Generics for them to work.

FUTURE POSTS

  1. RavenDB 7.1: The Gen AI release - 13 hours from now
  2. RavenDB and Gen AI Security - 4 days from now
  3. RavenDB & Distributed Debugging - 7 days from now
  4. RavenDB & Ansible - 12 days from now

There are posts all the way to Jul 22, 2025

RECENT SERIES

  1. RavenDB 7.1 (7):
    18 Mar 2025 - One IO Ring to rule them all
  2. Production postmorterm (2):
    11 Jun 2025 - The rookie server's untimely promotion
  3. Webinar (7):
    05 Jun 2025 - Think inside the database
  4. Recording (16):
    29 May 2025 - RavenDB's Upcoming Optimizations Deep Dive
  5. RavenDB News (2):
    02 May 2025 - May 2025
View all series

Syndication

Main feed ... ...
Comments feed   ... ...
}