This is my first project that i need to use some database ( using SQL server 2008 ).
I have the tables and now i need to decide how i will read the data from the tables.
I define dataset and i added some Querys that will return the information that i need to get from the table.
But i can also use the “LINQ to SQL Classes” to get the information from the tables.
I think that using the Dataset and/or using the “LINQ to SQL Classes” is very simple.
The questions that i have are:
1. Is there is some benefit of using DataSet or using the “LINQ to SQL Classes” ?
2. Witch of them have better performance ?
3. Is there some other reason to prefer one them instead the other ?
I would argue that the idea of an ORM like Linq-to-SQL is to turn the row/column structure of a relational table (which works great in the DB) into a .NET object with properties which is just so much easier to work with than a
DataSet / DataTable / DataRow / DataRow["colname"]structure in .NET. As an added benefit, you also get intellisense on your object and its properties, and those properties are type-safe, e.g. you know from your object thatAgeis anINTproperty and .NET won’t allow you to assign a string to that age property – with theDataRow["Age"], you can assign anything you want to it – you’ll get the error at runtime, when you try to save. Not a great programming experience!Just in terms of system performance: straight ADO.NET (DataSet etc.) will have slighly better performance mostly, since Linq-to-SQL is another layer on top of ADO.NET
In terms of programmer performance (productivity): using an ORM like Linq-to-SQL wins hands-down – no comparison!
I think these points are enough pro ORM:
At least for me, this is more than enough to never ever wanting to go back to
DataTable/DataRowprogramming….. it’s sooooo last century… 🙂