How do you to Access Data?

How do you to Access Data? dataWelcome to the latest news from TalkIT. This issue will look again at accessing data. Which system is best? Is it ADO.Net, LINQ or the Entity Framework? This is always a major theme in any serious software application. Please add your comments at the bottom of the blog. These are just some thoughts, based on 12 years experience training and developing. I would really like to hear your ideas. Introduction Access Data with ADO.Net Access Data with the Entity Framework Can you solve this coding problem? Other Bits Introduction In the April newsletter I asked the question: how do you access data? There was a massive response to this question. This included the 161 comments to date on the C# Developers / Architects Linked In group. This is one of the most popular comments:

In my opinion, ADO.NET is the best because it is quick lighter than Entity Framework. LINQ is excellent in manipulating List<> and working on the data you get.

Senior Software Engineer at ISO Ltd Chandan Choubey Big thanks to anyone who added a comment. Here is a brief distillation of the views expressed. It boiled down to a choice between “classic” ADO.Net and ORM systems, particularly the Entity Frameworks. References to LINQ to SQL occurred in fewer comments, suggesting that it is now a less popular ORM tool. Other tools recommended include NHibernate, Dapper and the Enterprise Library Data Access Application Block. Many people said they use whatever is appropriate, depending on the requirements. It is just a question of selecting the right tool for the scenario. To find out more about the range of data access options, just take a look at our courses and tutorials on this: Courses http://talk-it.biz/training/courses/ Tutorials http://talk-it.biz/training/tutorials/ Access Data with ADO.Net ADOThe first versions of Visual Studio provided only “classic” ADO.Net to access data. This consisted of classes that an application can combine to work with data directly. ADO.Net provides performance benefits as ADO.NET is the most low level tier that .NET provides for data access. The Entity Framework and LINQ sit on top of this. Working directly with ADO.Net can offer speed; this is particularly useful working with large amounts of data. The ORM systems may simply be overkill for simple data structures. The problem is ADO.Net is not versatile in dynamically changing situations. When a database schema changes, all those stored procedures and SQL queries have to be updated. But this is easier to do if the queries use parameters rather than fixed SQL strings.  Access Data with the Entity Framework frameORM systems automate the transfer of data between the database and the application’s objects. EF proved to be the most popular ORM system. Developers can concentrate on the business logic and be less concerned with the underlying database. And they can more easily switch databases providers; say from Oracle to SQL Server. EF works neatly with ASP.Net MVC web applications, integrating with the Model component in this design pattern. Most people opted for the Code First strategy of using EF, where you initially write C# classes to represent the model. Several people commented that unless you have a really solid understanding of EF, it can lead to poor performance and brittle code. I would agree that it is worth taking time to learn the EF’s large array of features. Can you solve this coding problem? Here is a coding puzzle. The aim is to write a short and elegant program. This time we are working with probability. Write a program in a language of your choice that calculates probabilities while throwing two dice.

  1. Inputs an integer from 2 to 36.
  2. Find the probability of this value be being the total when a pair of dice are thrown.
  3. Display the results.

This is a good introduction to probability, but how do we program it? The easiest way to start is to write out all the possible totals. There are 36 of them in all (6 x 6). So there is a only a 1 in 36 chance of throwing two ones. But a there is a higher probability of throwing a seven, since there are more combinations that total this (1 & 6, 2 & 5, 3 & 4). Other Bits bitsI am now putting more tutorials on the TalkIT website. These currently cover data access, C#, VB, OOP, web and windows development. They work with Visual Studio and SQL Server. Build simple business applications using step-by-step practical exercises. The idea is to provide a resource for software developers to improve their skills. They are currently free. The tutorials contain screenshots, code snippets and solutions that can be downloaded.

I am trying to get some feedback so any comments appreciated. ease of use – how easy to follow? topics – are these relevant? level – who would these appeal to?

 New online tutorials in MVC, C#.Net and HTML5 will be added in September. Take an advanced look at what is in the courses: MVC http://talk-it.biz/course/training-in-asp-net-mvc-4-web-development/ C# http://talk-it.biz/course-products/csharp/ HTML5 http://talk-it.biz/course/html5-css3-javascript/

Photos www.freedigitalphotos.net/

David Ringsell 2014 ©

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top