<p>I am currently architecting a small CRUD applicaton. Their database is a huge mess and will be changing frequently over the course of the next 6 months to a year. What would you recommend for my data layer:</p>

<p>1) ORM (if so, which one?)</p>

<p>2) Linq2Sql</p>

<p>3) Stored Procedures</p>

<p>4) Parametrized Queries</p>

<p>I really need a solution that will be dynamic enough (both fast and easy) where I can replace tables and add/delete columns frequently.</p>

<p>Note: I do not have much experience with ORM (only a little SubSonic) and generally tend to use stored procedures so maybe that would be the way to go. I would love to learn Ling2Sql or NHibernate if either would allow for the situation I've described above.</p>

[{'answer_id': 11886, 'author': 'Jon Limjap', 'author_id': 372, 'author_profile': 'https://Stackoverflow.com/users/372', 'pm_score': 1, 'selected': False, 'text': '<p><a href="http://www.hibernate.org/343.html" rel="nofollow noreferrer">NHibernate</a>, but only if you would be amenable to having an object-first approach wherein you define your classes, and then define your desired table structure in the mapping files, and then create a database schema using NHibernate\'s built in schema generation classes.</p>\n\n<p>For doing it the other way around (e.g., you have a bunch of tables and then you base your object design on that) I\'ve found <a href="http://www.mygenerationsoftware.com/" rel="nofollow noreferrer">MyGeneration</a> + NHibernate to work, although I\'m not too happy with the resulting classes (mainly because I\'m such a stickler for true Object Oriented Programming).</p>\n'}, {'answer_id': 11890, 'author': 'Aidan Ryan', 'author_id': 1042, 'author_profile': 'https://Stackoverflow.com/users/1042', 'pm_score': 0, 'selected': False, 'text': "<p>You're already happy with stored procs and they might be enough to abstract away the changing schema.  If ORMs aren't happy with stored procs then maybe they'd work with Views that you keep current on top of the changing schema.</p>\n"}, {'answer_id': 11932, 'author': 'lomaxx', 'author_id': 493, 'author_profile': 'https://Stackoverflow.com/users/493', 'pm_score': 4, 'selected': True, 'text': "<p>One key thing to be aware of here is that if the database schema is changing frequently, you want to have some level of compile time type safety. I've found this to be a problem with NHibernate because it uses xml mapping files so if you change something in your database schema, you don't know until runtime that the mapping is broken.</p>\n\n<p>It will also be a problem with stored procs.</p>\n\n<p>Using Linq2Sql will give you the advantage of knowing where exactly your code is breaking when you change a schema at compile time. This for me, is something that would take precedence over everything else if I'm working with a frequently changing schema</p>\n"}, {'answer_id': 11949, 'author': 'Jon Galloway', 'author_id': 5, 'author_profile': 'https://Stackoverflow.com/users/5', 'pm_score': 3, 'selected': False, 'text': "<p>I'd look at SubSonic with the build provider (Website Project) setup. That works great because it automatically regenerates the DAL objects every time you build your project, so if the database changes in a way that breaks your code, you get a build error.</p>\n\n<p>It worked well until the database schema got really complex and we were hitting the limits of the ActiveRecord pattern, but as long as the schema's not hugely complex it works pretty well. Once the schema stabilizes, you can switch so that you're only building the DAL when you want to.</p>\n"}, {'answer_id': 16539, 'author': 'Webjedi', 'author_id': 1975, 'author_profile': 'https://Stackoverflow.com/users/1975', 'pm_score': 1, 'selected': False, 'text': "<p>If I were in your shoes I would try to leverage what I knew (sprocs) with Linq2Sql.  Linq2Sql can still use your sprocs but then you have the added bonus of putting a new tool in your belt.  I think having a grasp on the Linq2XXX (X being a random technology not adult entertainment....which isn't a bad idea now that I think of it) syntax and methodology is going to be a great addition to your skill set using Linq over a collection of objects is way sweet.</p>\n\n<p>But ultimately something like NHibernate will suit you better in the long run.</p>\n"}, {'answer_id': 75575, 'author': 'komma8.komma1', 'author_id': 13355, 'author_profile': 'https://Stackoverflow.com/users/13355', 'pm_score': 2, 'selected': False, 'text': '<p>You definitely want to use an ORM. Any ORM is ok, but you want something that will generate strongly typed classes. When fields get added, modified or deleted from a table, you want to be able to regenerate those classes, and deal with fixing compile time errors only. If you use a dynamic model, you\'re likely to have many nasty runtime errors. This is VERY important!  I am part of the <a href="http://www.mygenerationsoftware.com/" rel="nofollow noreferrer">MyGeneration</a> development team on sourceforge, and I think that is a great solution to your problem. You can generate dOOdads, NHibernate, EasyObjects, EntitySpaces, etc. If you want to go with a more expensive solution, go with <a href="http://www.codesmithtools.com/" rel="nofollow noreferrer">CodeSmith</a> or <a href="http://www.llblgen.com/defaultgeneric.aspx" rel="nofollow noreferrer">LLBLGen Pro</a>. Good luck - anyone interested in using MyGeneration, feel free to contact me with questions.</p>\n'}, {'answer_id': 75692, 'author': 'Davide Vosti', 'author_id': 1812, 'author_profile': 'https://Stackoverflow.com/users/1812', 'pm_score': 0, 'selected': False, 'text': '<p>If the database schema changes often, prefer the Entity Framework over LINQ2SQL. If the schema changes, using L2S you have to<br>\n1) Remove and re-add you table (loosing your customizations)<br>\n2) Modify the model by hand (as done here in stackoverflow)</p>\n\n<p>The EF is a super-set of L2S, giving you more flexibility of usage and dbms-independence</p>\n'}, {'answer_id': 375665, 'author': 'Steven A. Lowe', 'author_id': 9345, 'author_profile': 'https://Stackoverflow.com/users/9345', 'pm_score': 0, 'selected': False, 'text': "<p>look at why it is changing, and see if you can anticipate and generalize the kinds of changes coming at you so that they don't break your code</p>\n\n<p>a framework may make accomodating the changes easier, but deeper analysis will have a longer-term benefit</p>\n"}, {'answer_id': 375682, 'author': 'Marek Blotny', 'author_id': 33744, 'author_profile': 'https://Stackoverflow.com/users/33744', 'pm_score': 0, 'selected': False, 'text': '<p>Any solution can work, what you really need is a set of tests which will guarantee that basic operation like insert, select, update and delete works. This way you can simply run your tests and check if mappings are up-to-date.</p>\n'}, {'answer_id': 473081, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>EntitySpaces can regenerate your DAL/Business Layer in one minute, and no code loss, see the trial version ==> <a href="http://www.entityspaces.net/portal/TrialDownload/tabid/177/Default.aspx" rel="nofollow noreferrer">HERE</a></p>\n\n<p>No Registration Necessary, runs under Visual Studio as well.</p>\n'}, {'answer_id': 2795633, 'author': 'Ron H', 'author_id': 303614, 'author_profile': 'https://Stackoverflow.com/users/303614', 'pm_score': 1, 'selected': False, 'text': '<p>Use EntitySpaces. you will send me flowers, guaranteed.\nsimply awesome. change the db as you like. hit the button, bang. all your changes are done. without changing your custom code. I love it.</p>\n'}, {'answer_id': 2795806, 'author': 'TheEruditeTroglodyte', 'author_id': 215216, 'author_profile': 'https://Stackoverflow.com/users/215216', 'pm_score': 1, 'selected': False, 'text': '<p>How simple is the application?  If I were to be working with schema/design stuff for a couple of months, and not really worry about an actual app . . . I would consider using EDM and a Dynamic Data Entities Web Application project.  This get your going with the least amount of effort, in my opinion.  This keeps you focused on schema, data and other groovey things.  I hopefully don\'t get too many neg bumps from this one!</p>\n\n<p>Here\'s how the new project dialog will look like <a href="http://www.flickr.com/photos/markandjamie/4590272584/sizes/o/in/set-72157623895271809/" rel="nofollow noreferrer">this</a></p>\n'}]
['https://Stackoverflow.com/questions/11878', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/285/']