As many of you know I have made some strong statements in the past regarding ORMs (in fact I’ve probably lost readers over it). Recently in my day job, I was given two projects that I decided to use an ORM for (and I used different ones each time). I used the writings of my fellow blogger, David Haydn, to help me settle on an ORM for each project.
Project #1 – CastleProject’s ActiveRecord with MS Access
Yes, you read that right. I had to use Access with a fairly small web project (this was the client’s spec not mine). So as I looked around I saw that there was a driver for the Castle Project’s ActiveRecord to use MS Access. Development went fairly smooth although not necessarily any faster than when I use CodeSmith to generate a DAL (although admittedly, I was still learning the Framework a little). At the end I did have to do a marathon run of replacing Castle’s ActiveRecord due to Medium (with some custom changes to allow Access via OLEDB) security in a hosted environment… The punch line is that this would have worked, but only the web site could use OLEDB (any assemblies that one was using were not trusted enough to do OLEDB). All in all it wasn’t a horrible experience. I would use Castle ActiveRecord again, but I won’t be going out of my way to do so. I didn’t feel that it bought me much (yeah, being able to query via code is cool… even if you are writing SQL dynamically <wink />)
Project #2 – ActionPack/SubSonic with MS SQL
I had seen a number of people raving about what a time saver this one was as well as the power it gives you. After watching the 10 minute video of it I was sold. This was the 1 ORM I could probably use at the corporation where Stored Procs were the only legitimate method for accessing a table. While I am still on the fence over the generation of SQL statements at runtime, this is the project that might convince me. The project is not completely done, but I have been able to do quite a bit with a full set of tools. What I haven’t been able to accomplish with the ORM I have been able to easily substitute in Stored Procs (and use them easily). I’m using the CodeGen method so I can generate my base ORM/DAL classes and then I have a separate project where I have extended these classes. I’ve had a couple issues that a recent code refresh has helped me with. The only weird thing I have really had to do was recompile their source code to get rid of the MySQL driver (since I’m not using that and am not so sure what my boss would say if he saw it in the bin directory of the site). This has been an awesome experience, and I’m thinking of scrapping my CodeSmith templates because this provides everything that my CodeSmith templates provide me, and provides so much more than what I’m already doing (for instance all collections can accept a DataReader as a parameter for populating the collection; the storedprocs class provides a way to easily execute a storedproc and get a reader; being able to throw together a quick query without having to launch the SQL Server tools has also come in handy… I’m impressed to say the least). This tool may have converted me…
[tags: ASP.NET, ORM, SQL Server, C#]
Print | posted on Tuesday, December 12, 2006 8:57 PM