Presently I personally use many of the ado.internet classes (SqlConnection, SqlCommand, SqlDataAdapter etc..) to create calls to the sql server. Is the fact that an awful idea? I am talking about it really works. However see many articles which use an ORM, nHibernate, subsonic etc.. for connecting to SQL. How come individuals better? I'm just attempting to realise why I will have to change this whatsoever?
Used to do look into the following tutorial on using nHibernate with saved-methods.
Nevertheless it looks in my experience this is much to overkill. Why would I must produce a mapping file? Even when I produce a mapping file and allows say my table changes, then my code wont work any longer. If however I personally use ado.internet to come back an easy datatable then my code will still work. I'm missing something here?
There is nothing wrong with while using fundamental ADO.Internet classes.
You may have to perform a much more manual work than necessary. Should you e.g. choose your top ten clients from the table with SqlCommand and SqlDataReader, the choice is yours go iterate within the results, take out every single single item of information (like customer number, customer title, and so on), and you are dealing very carefully using the database structures, e.g. rows and posts. That's acceptable for some situations, but an excessive amount of operate in others.
How much of an ORM provides you with quite a bit of this "hard work" being handled for you personally. You simply tell it to obtain a listing of the top ten clients - as "Customer" objects. The ORM goes off and grab the information (probably using SqlCommand, SqlDataReader) after which tugging the odds and ends, and assemble nice, simple to use "Customer" objects for you personally, that are much simpler to make use of, being that they are what your code is coping with - Customer objects.
So there's certainly no problem with using ADO.Internet and it is a positive thing knowing how it operates - but an ORM can help you save lots of tiresome, repetitive and boring hard work and allow you to concentrate on your real business problems around the object level.
To begin with, the ORMs will probably perform a far better job at creating the SQL queries than your normal non-SQL specialized Joe :)
Next, ORMs are an easy way to somewhat "standardize" your DALs, growing versatility over different projects.
And finally, with a decent ORM, you are likely with an simpler time replacing your underlaying data-source, like a good ORM may have a variety of dialects. Obviously, case a side-bonus :)
ORM's are wonderful to prevent code repetition. You are able to frequently discover that your object model and database model are very near to one another and if you give a area you will be adding it towards the database, your objects, your sql claims in addition to otherwise. If you are using an ORM then you definitely improve your code in one location also it develops the relaxation from it for you personally.
For performance, this could go in either case. You'll most likely find that many the easy sql that's written for you personally is frequently very customized with assorted cutting corners that you'd happen to be too lazy to create, for example only coming back the absolutely needed data. However, for those who have some very complex queries and joins that the robotic voice couldn't possibly build then you are better of keeping these written yourself.
To sum up though, they are fantastic for fast develops!
You don't have to change. If SqlConnection, SqlCommand, etc. meet your needs then that's great.
They work just peachy acceptable for the DB application I am developing, and that i have a large number of concurrent customers without any problems.