stirring the pot

this should make for an interesting thread.
Actually, that's kind of why I posted the link. After your thread855-1546098 thread, I convinced our team that for our next project that we should try to use an O/RM to see if it did bring us any benefits and the system we built has now been live for just over a month.
I just thought I'd share my thoughts now that I have first hand experience of using one and what pros/cons I think it brought us.
To give a brief overview, the system was for a local council (around 2500 users) to record information relating to the type of contact that they receive from the public (i.e. they log each phone call, letter, email etc) for each department. Anyone can log an entry in the system and after a month of running the system we can see that on average there are around 16 entries per second across the system so there is a reasonable level of input into the system. There is also a second "management system" that has built in reports to allow department managers to run reports for their own department. There is also a corporate department which has access to all reports. Both systems run on the existing SQL Server 2005 database server that the council currently uses and it will be accessed using windows authentication.
Initial Development
There was always going to be a bit of a learning curve for our team here (and therefore this stage took a lot longer than normal, but that was to be expected) so it's quite difficult to gauge whether it would have sped up our database and data access layer creation. If I had to guess though, I'd say it was negligible either way between using SSMS Tools Pack to auto generate our stored procedures and then tune them as it was to create the mappings from the ORM so I'd be inclined to say this section was a 50/50 split in term of the benefits. However, I also understand that this is purely an opinion as opposed to hard facts backed up by statistics.
Performance
I don't have two sets of figures to directly compare, so these are just my observations.
There appears to be absolutely no difference between what the O/RM produced for the system that the users use to insert the contacts and what I would have written in a stored procedure. The inserts work quickly and there are no issues at all with performance and speed.
The management system does have some problems though. The reports that they run are usually just "grouping" type of reports so that they can see how many of each type have been entered, and split across departments for certain timescales. Looking at the cached execution plans, the generated sql quite often uses the primary key index on the reports which depending on what options the manager selects isn't necessarily the best one. Using a stored procedure I would simply add a hint to tell it what index to use which would help speed things up, but I'm not sure if this is possible in the ORM.
Security
This was a bit of a concern for us. As we were using SQL Server with Windows Authentication, users and managers connect to the database using there own security context. As the ORM obviously uses dynamic sql we had to allow direct table access so that any SELECT,UPDATE,INSERT/DELETE statements could be executed for the users and managers (essentially, people became data readers and writers). However, this presents two problems:
1. It means anyone with Microsoft Access/Excel (i.e. everyone in the council as it's part of the corporate desktop) can connect to the database and view and modify data.
2. Due to the previous problem, it means managers from one department can see data from another department using the Office method. This has caused a bit of a stir in the council and they weren't happy that this could be done.
We are currently looking into whether we can change the design to put each departments data into different schemas, or somehow partition the data to limit access based on the users windows authentication credentials.
Maintainability
This has been a bit of a mixed bag really. A couple of my developers have liked the OO approach that they have when accessing the data layer and say that it will help maintain the project, especially when they come to view it months after having written it, or when a new developer looks at is as it should be more obvious what is going on.
However, it has also caused us problems in terms of modifications to the data retrieval and the re-deployment of the application. We had to make a change to the user system to exclude some contact types that they now have deemed "inactive" (it wasn't an initial requirement to have a active/inactive flag for the types, so we just appended this field onto the table, updated the values for existing records and set the default for new entries). As this change meant we had to add the where filter to the code (as opposed to in the stored procedure) this meant that we had to recompile and redeploy the application. As we are not allowed to take any systems down during working hours this meant that we had to schedule someone to do this out of hours which also meant that there was an extra cost implication to the business that wouldn't normally be there.
Summary
I realise that not everyone will have the same experiences we have had but overall I think there were a few benefits the ORM brought us that we don't have now (such as the OO approach both in terms of initial development and maintenance going forward). However, and I don't know whether this would be applicable to every project and/or other people in their working environment, I have to say that we found that it caused more problems than it actually solved. The performance problems I'm sure can probably be ironed out to be negligible (or at least I hope they can), but the security and deployment issues have been a real pain for us (and these are issues that we wouldn't have usually had).
So, for us, our analysis proves that it probably isn't in our best interests to use an ORM and that a stored procedure approach would be a more secure, cheaper and less problematic development path.
Mark,
Darlington Web Design
Experts, Information, Ideas & Knowledge
ASP.NET Tips & Tricks