Contents tagged with ActiveRecord
-
ActiveRecord: Loading Records by Primary Key
I was reviewing some code today for a project that uses ActiveRecord. One of the things that stood out for me was the use of a query to find objects by their primary key. There's two reasons this raised a red flag for me:
-
NHibernate Queries: HQL vs. Criteria API
As someone who did a lot of SQL a few years ago, I was immediately more comfortable using HQL for my ActiveRecord queries than the Criteria API. But from a documentation/samples standpoint, I see a much higher percentage of the Criteria API being used vs. HQL. I still use HQL most of the time.
-
OutputDebugStringAppender in a web app?
I spent a couple of hours yesterday trying to get log4net to log to an OutputDebugStringAppender with no success. At first, I thought I had a configuration error in log4net so I added a file appender and that works fine. It's a Monorail application that uses ActiveRecord for database access. There's a couple of spots where I wanted to check out the SQL being generated by ActiveRecord (NHibernate). I did all my set up for log4net and even got it logging to a FileAppender. But I wanted to log the SQL to an OutputDebugStringAppender.
-
ActiveRecord: Never forget there's a database
Some lessons learned while using ActiveRecord.
-
Generate ActiveRecord Classes from Existing DB Schema
GeneratorStudio is a project on CodePlex used to automate the creation of Castle ActiveRecord classes from existing database schema. I haven't downloaded it yet to play around with it, but it looks like it would be a nice thing to have if you have a large (or even medium) schema that's already in production and you'd like to start using Castle ActiveRecord for DB access.
-
Mock Databases and ActiveRecord
Fellow SRT employee Jay Harris has a great post on using SQLite's in-memory database feature to mock his database. He points out a few of the factors that drove him to investigate such an approach:
-
ActiveRecord and a Custom NHibernate PrimitiveType
I was intrigued by Steve Smith's blog post yesterday about reducing SQL Lookup tables in nHibernate. He gave an example of a WorkOrderStatus class the exposed the actual status as a POCO object that wasn't stored in the database. What really piqued my interest was the following comment:
-
ActiveRecord + HQL and an "IN" clause
Late last year as I was using MonoRail and ActiveRecord for a simple web application. I was helping my local church find volunteers with various skills to teach some basic computer courses to the the church staff. I wanted to keep track of the volunteers along with the skills they had. I used this as another opportunity to learn more about MonoRail and ActiveRecord.
-
Lazy Loading/Eager Loading
The NHibernate FAQ has a new post about complex object graphs and lazy loading. If you use NHibernate (or, ActiveRecord -- which makes NHibernate a whole lot easier), it's worth a look. The technique described can greatly improve the way your app interacts with the database. OR mappers are nice, but you need to make sure you understand what is happening with the database calls that are made automatically by your OR framework.
-
SRT's ActiveRecord Coding Sprint (and a "gotcha" to watch out for)
After our open house, a few of SRT's consultants stayed to have a little Coding Sprint with Castle -- specifically, ActiveRecord.