Skip to main content

Posts

Showing posts from May, 2007

Castle ActiveRecord class with stored procedures

Update 05/22/2007: No response from the community. I think Hammett is working on releasing a new version of Castle (It's much more than just ActiveRecord!), so I have not received any feedback on my patch. I have just posted patch AR-156 to Castle's ActiveRecord project to add support for XML free mapping of insert, update and delete stored procedures to ActiveRecord classes. This requires a bit of work, since the stored procedures must match the field order generated by NHibernate , rather than being controlled by the application developer. This means that we have to create the class normally, run it through a test cycle with logging turned on, capture the prepared statement's field order, and then re-write the stored procedure to match what NHibernate wants. This is because behind the scenes the stored procedure replaces a prepared sql statement that NHibernate would otherwise be using. This will be a mess to maintain until or unless someone contributes a patch to ...

Reflector, Doubler and Unit Testing

Update: the latest versions of Reflector and Doubler are working well together. I just noticed that Jay Flowers has released a version of the Doubler Add-In that works with the current Reflector by Lutz Roeder . I tried installing Doubler in a sub-directory under Reflector, but it failed to load, so I had to move it into the Reflector directory. The current version of Doubler generates test stubs with a mis-spelled attribute (Memeber instead of Member), but it will generate test stubs, interfaces, recording wrappers, mock objects, etc. It seems like it will be quite handy, with support for NUnit, MBUnit, etc. although Doubler forgets all of your settings every time you move to a new class. That is almost a deal breaker there, but at least you can select an assembly and generate all tests at once. I have to change the output language to c#, change the output path (or just build where the tool wants to go, and copy it), change the default test framework, and set "WithTestAtt...

NHibernate 1.20 is released!

NHibernate was released May 3, 2007 and they have a migration guide for those of you who do not follow changes in the svn. This release supports stored procedures, and as you can see in the screen shot above, I am working on adding SQL stored procedure generation to my ActiveRecord Generator. I have templates for INSERT, UPDATE and DELETE now, and I will write a SELECT by primary key today. It's too bad I can't just write an attribute to append to the NHibernate mapping file that ActiveRecord creates. I don't know if I will have to write my own ActiveRecord attributes, but the Castle Project seems very friendly to patches. This is very important because I would not really want to release a program that requires a patched library. I have found several bloggers who have created NHibernate + Stored Procedure samples, but none that have ActiveRecord samples (since we do not have the attributes yet). If you have been working on something, now is your chance to share. (...