|
Good point. Have the same issue.
I ended making a custom sort of N-Tier Layered and Entity-like hybrid ORM Library.
You may like to read a previous answer of this scenario, in a previous answer, on this same page ...
|
|
|
|
|
EntityFramework allows the use of views and stored procedures in place of tables. I use stored procedures for create, update and delete, and use views for retrieve. When I alter a table, it is very simple to update the application from the database. The application itself is just the server side of a web API, which works without my having to specify individual column names, until I get to the actual use of the data in the web client.
I will say that I also don't like the sometimes buggy black box that ORM tends to be. I wrote a PHP version of my server application in which all of the tables and column names are specified in one, simple class file, and all of the routing is specified in one other simple file. The code is fairly transparent and, except for those two files, it is unnecessary to make changes to it to adapt to entirely different database structures, but I can easily do so, if necessary. The flexibility of PHP allowed me to do all that an ORM would do without an ORM black box.
|
|
|
|
|
As an experienced ADO.NET/TSQL developer, it's been my experience on every project that has used EF, headaches and issues have arisen during maintenance and while attempting changes.
For years, I thought perhaps it's because EF wasn't properly implemented in the first place.
I mean, who doesn't enjoy generated data entity class objects, etc...
After readying quite a bit of negativity on using ORM's instead of stored procedures, it's
obvious that the opposite of rational knowledge is one's intuition, or gut feeling...
Thus, I feel slightly vindicated but should have listened to my instinct all along..
|
|
|
|
|
Whatever you do, don't use LinqToSql, actually yeah, don't use any of that.
it ain’t broke, it doesn’t have enough features yet.
modified 20-Oct-19 21:02pm.
|
|
|
|
|
Is LinqToSql even actively developed any more?
|
|
|
|
|
I'm with Pete. What would you actually gain by using any of them?
"Use the right tool for the right job." -- Scotty et al.
ORMs can be likened to a pneumatic nail gun -- very useful when building a house, not very useful for building a bird house and completely wrong for constructing an electronic circuit.
Always consider your application and its needs on its own, don't simply make it match what some other developer did for some other application which may have absolutely no bearing on what your current application needs to do.
None of the applications I have ever developed would have benefited from using an ORM, or "entities", or "custom data objects". I doubt even ten percent of the applications out there really benefit from their use.
|
|
|
|
|
The benefit is a great reduction in the time required to code a new application.
|
|
|
|
|
For smaller projects, any benefit in code writing time is outweighed by the time taken to learn the ORM.
Similarly, I have found, many ORMs (that I have tried) seem to generate over-complex code under the bonnet.
I may not last forever but the mess I leave behind certainly will.
|
|
|
|
|
I'm using nHibernate now and I don't like it.. for the very same reasons Pete pointed out.
I've always been a big fan of Linq-To-Sql.. for the very same reasons Pete pointed out.
If it's not broken, fix it until it is
|
|
|
|
|
Use the repository pattern and you can swap in/out ORM to suit yourself.
|
|
|
|
|
If you are using ASP.NET MVC, Entity Framework would be the recommended ORM framework.
|
|
|
|
|
The question you should ask yourself is, which technology is most likely to land you the next job.
What, me cynical?
|
|
|
|
|
I have previously written applications that don't use ORM, but did use it in a recent project. I disagree with most of the others, in that I found it very beneficial to use. It doesn't stop you doing other stuff if you need to, but makes many aspects of database interaction much, much easier.
In my case it was the entity framework I used.
Cookie
|
|
|
|
|
Never use Linq to SQL.
If you are developing in ASP.Net MVC, i think you can use Entity Framework 6 or 7.
ORMS have really gotten better in the past few years, and there is not a lot you can't do with them.
EF7 infact has improved performance comprd to 6 but still has some missing features.
|
|
|
|
|
|
What's with all the LinqToSQL hatred?
|
|
|
|
|
My applications all use stored procedures and queries in which I make full use of joins and variables to do what I need. Linq often makes very simple tasks much simpler, but the strong datatyping of Linq sometimes makes slightly more complicated things impossible to code or impossible to debug, and my code grows tremendously to get what would otherwise be simple things done.
|
|
|
|
|
I don't disagree with anything you've written. I frequently have code with LinqToSQL and without. No reason you can't mix in the same project.
I just don't get the blanket 'never use it' sentiment that some people have shown.
|
|
|
|
|
I have used both Entity Framework and NHibernate extensively. I would say that if you are using the ASP.NET 5 (ASP.NET CORE) technology then EF7 is a good tool but if you aren't using the cutting edge ASP.NET tech then I prefer NHibernate but EF 6 will work as well. Please note, EF7/ASP.NET 5 (CORE) are not out of beta yet...
Like others have pointed out, this also depends on your project. From my recollection, NHiberante has the ability to connect to a lot more data providers so if you need to integrate with MySQL, MsSQL, Oracle, etc. in the same project then NHiberante might be a better choice.
Food for though
Eric
|
|
|
|
|
NHibernate and other (Open Source and Commercial) Libraries are good.
I had a case, where I consider to use a very previous version of NHibernate, but, couldn't, due to switching between VS versions, and poor documentation.
NHibernate was my first choice, but, have to drop all of them in favor of a custom ORM, which to be honest, was difficult to implement. Wish NHibernate had better documentation and examples at that time...
|
|
|
|
|
|
I'm currently using nHibernate with FluentNHibernate. I like it, for easy queries from tables. Having said that, I'm trying to get rid of it and switch to Dapper. My website has gotten way to complex for nHibernate queries. I have to do anywhere from 3 to 30 SEPARATE calls to the database just to get all of the data for my view model. That's AWFUL, and one of the huge downsides to non-asynchronous ORM's. At my work, we use an ORM-lite, similar to Dapper. It is AWESOME! You write all of the stored procedures to access all database information, it's fully asynchronous, AKA FAST! I recommend something like Dapper.
|
|
|
|
|
Use the one you "like".
I use Entity Framework "Code First" for all my prototyping; big or small.
I deal with a lot of XML related services / data imports.
With EF and Visual Studio, I can take XML data and definitions, and generate a fully loaded SQL Server databases that can be accessed in any number of ways, including LINQ to Entities, in under 30 minutes. I don't even have to think about whether there is an easier way.
The original model can subsequently be expanded upon using partial classes; leaving the original model intact (and simple).
|
|
|
|
|
|