Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,026 | Comments: 44,842

filter by tags archive

Hibernating Rhinos - Episode #1: Rhino Mocks 101

time to read 1 min | 136 words

To celebrate the Rhino Mocks 3.0 release, I produced a screen cast of about an hour, talking about how you can use it. This is the very first time that I am doing something like this, so the list of fubars in this episode is fairly long. For instance, I didn't realize that the Play/Pause bar would appear in the final movie, or thought about closing the IM during recording, etc.

At any rate, I think that this could provide a gentle introuction to Rhino Mocks, and help understand how to use it. The first few minutes are introductions and power point, but from then on, it is all code, so have fun.

You can watch it here.

Oh, and happy mocking.

Hibernating RhinosIntroduction

time to read 1 min | 191 words

Hibernating Rhinos is a series of screen casts that I am going to make, basically they include me, a microphone, code and Camtasia.The sound quality is going to be aweful, I presume, and it turn out that I speak English sloowly. It may very well be the case that I can type English faster than I can speak it.

I guess that I don't need to explain the choice of the name, but I am still looking for a logo / picture that I can use.

My editing skills are even more limited than my UI skills, so you are going to see some funny stuff, probably, but I hope to learn to do better. Feel free to send suggestions, comments, etc to me. No fixed time, not fixed subject.

The first topic is Rhino Mocks, basically an introduction to what it can do. The second topic is going to be about MonoRail. Beyond that, feel free to suggest topics, but I will say out front that I'll not be able to do them all.

When pressed for answers...

time to read 1 min | 107 words

Q: How will you do this?
A: Web Service

Q: How will you do this?
A: BizTalk

Q: When will it be done?
A: Later

Q: When will it be done?
A: Count the links in the screenshot, I do a link a week.

The first two are usually good answer for a lot of questions, up to and including walking the dog and making coffee. The last two are useful for UI changes.

Rhino Mocks 3.0 Released!

time to read 4 min | 782 words

I gave it a few weeks outside, and quite a few people downloaded and tried it, so I am feeling good about it. I had a surprised that kept me from release the 3.0 for a while, but I'll talk about it later.

The binaries and code are in their usual place, here.

(Image from clipboard).png


  • Moved all the constraints to Rhino.Mocks.Constraints namespace. This was done to avoid conflicts with NUnit and MbUnit's new assert syntax.

New features:

  • Generic Methods (at last!)
  • Support arrays of value types as out parameters
  • Support non-CLS Compliant value types such as UInt64
  • Better error messages when using generic delegate methods on generic types
  • Generally faster
  • Using Dynamic Proxy 2 - better performance, better code-base, full support for weird generic scenarios.
  • Text.* constraints can now be used to evaluate non strings as well, by calling the ToString() method. Useful for things such as the Criteria API in NHibernate.


  • The CallOriginalMethod() was deprecated, you are now encouraged to use CallOriginalMethod(OriginalMethodOptions.NoExpectation) or CallOriginalMethod(OriginalMethodOptions.CreateExpectation) instead. The reasoning behind the change is that currently CallOriginalMethod looks like it create an expectation, but it doesn't really does it,  it is better to be explicit about the whole thing.
  • The build script will internalize almost everything no related to Rhino Mocks (Except AbstractInvocation) - prevent conflicts from users that uses both Dynamic Proxy and Rhino Mocks - i.e, me).

Bug fixes (from previous 3.0 Beta):

  • Fixed regression with closed generic types inheriting from open generic types that contains generic properties of the generic type, if the property is overriden
  • Fixed issues with the generic method return values.
  • Regression with closed generic types inheriting from open generic types that contains generic properties of the generic type, if the property is overriden
  • Fixed a problem with the new semantics of CallOriginalMethod
  • Fixed a problem mocking internal types that are not nested
  • Fixed a misleading exception when you pass a mock object of type that override ToString() to an unexpected method.
  • Fixing another issue with AbstractExpectation not checking the real return type of generic methods.
  • Fixed issue with generic method call on generic type for interfaces
  • Fixing an issue with BackToRecord no clearing originalMethodsToCall expectations.
  • Improved support for wacky generics scenarios.
  • Better support for types having non inheritable attributes that cannot be easily replicated.
  • Better support for types implementing interfaces by using a base class that is located in another assembly.

NHibernate Migration Guide: From 1.0 to 1.2

time to read 2 min | 300 words

Billy McCafferty may have intended just to give a sample of how to move from NHibernate 1.0 + my NHibernate.Generics to NHibernate 1.2, but his post is actually a very good guide about migrating in general from 1.0 to 1.2.

The part that you really want to do is in the end, where you want to verify that:

  • Do updates to a child, via the parent, still work?
  • Do creations of new children, added to the parent, persist to the database?
  • Do deletions of existing children from the parent, or by deleting the child directly, work correctly?
  • Have other CRUD, cascade scenarios been tested?

I have said it before, I trust NHibernate to manage my objects, but I want to verify that what I think the mapping are, and what they are actually doing are the same. Cascading and lazy loading are two of the most important parts that you want to verify when you migrate, and you really should make sure that you have working tests before you do it. For the rest, check out Billy's post.

Linq for NHibernate Updates: Adding a new committer

time to read 1 min | 92 words

Following several good patches, I have added Bobby Diaz to the Rhino Tools project, which currently includes the Linq for NHibernate implementation as well. I expect that the new stuff will be up in the repository shortly.

Just to remind you, I am still looking for more volunteers to help with the implementation, so if you are into futuristic technologies, just dive right into the code and the implementation details. And be sure to send me (or Bobby) a patch or two.

Data Migrations Woes

time to read 1 min | 197 words

For some reason, customers insist on putting their data in a database, which is all fine and dandy. But then they also insist on taking it out! Which is hardly fine at all.

The fun part starts when the source is a little known database called Oracle, and the destination is a new arival from out of town, who goes by the nick name SQL Server.

Fun stuff that I run into today:

  • PK in Oracle are Number, in SQL Server, it is interpreted as double or float. Do try to query for Id = 12324.432154
  • Wierd PK - such as 1,001,0004,001,000 - a real PK that I run into today. No idea how it got to this point.

I am using both P/L SQL Developer and SQL Plus, and I have to say that both have some distinct advantages over SQL Server Management Studio. Just Ctrl+Click is an invaluable assest when you try to figure out what you are doing.

WatiN + MbUnit

time to read 4 min | 660 words

Verifying invalid input...







public void TryingToEnterWithInvlidPolicyNumberShowsError(string id)




    AssertContainsText("Can't find Policy with id #"+id,"Should give error message for invalid input");



No future posts left, oh my!


  1. Technical observations from my wife (3):
    13 Nov 2015 - Production issues
  2. Production postmortem (13):
    13 Nov 2015 - The case of the “it is slow on that machine (only)”
  3. Speaking (5):
    09 Nov 2015 - Community talk in Kiev, Ukraine–What does it take to be a good developer
  4. Find the bug (5):
    11 Sep 2015 - The concurrent memory buster
  5. Buffer allocation strategies (3):
    09 Sep 2015 - Bad usage patterns
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats