« Write Table content from Database to XML file | Main | Write a simple object to and from XML using C# »

The myth of LINQ (simplest sample for ADO.NET Entity Data Model)


If you are a .NET fan out there then you will basically hearing from many people asking, I have ADO.NET 2.0 so why is there a LINQ? It was a myth to me too. After Microsoft launch Service Pack 1 for Visual Studio 2008 then I clear some of my cloud in my head.

I will only mention one of the unique features here, ADO.NET Entity Data Model from ADO.NET Entity Framework. I have not found a better way to bind the Entity Model to DataGridView web control.

In order to create ADO.NET Entity Data Model, right click either Windows Application Project or Web Application Project and choose Add New Item… . Select ADO.NET Entity Data Model from the Add New Item dialog. After that you will have a file with edmx extension.

I have created a complete Windows Application sample using Northwind database in MS SQL 2008 Express. The Entity named NorthwindEntities. The entire sample consisted of 2 controls, 1 DataGridView and another is Button. I only have few lines of code in Button click event as below.

 private void btnGetCustomers_Click(object sender, EventArgs e)

{

  NorthwindEntities nwe = new NorthwindEntities();

 

  var cus = from customer in nwe.Customers

            select customer;

 

  dataGridView1.DataSource = cus;

}

I guess no one will ever say this is difficult.

The complete code is in http://skydrive.live.com. The sample file name is WinAppEntities.rar. My MSN ID is chanmmn@hotmail.com.


Unfortunately, ADO.NET Entity Data Model is not working with Oracle Database yet.

Comments (5)

Kamil F:

Is there any or it will by any support for Oracle (linq for Oracle?)

There is an free oracle implementation at:

http://www.codeplex.com/LinqToOracle

LINQ its not a Myth, its a fact that Java Programmers wish to have, but they dont.


Mike:

Java programmers have "Persistence". With better support for the Oracle database.

Anonymous:

if you favor linq to oracle, please try alinq, the bestest database linq provider. it supports Access, SQLite, Oracle, MySQL and Firebird database.please visit http://www.alinq.org

Scott Guthrie:

alinq is not very good and is riddled with bugs. I was completly broken as far as oracle provider goes. I think it is a scam.

Post a comment

About This Entry

This page contains a single entry from the blog posted on October 19, 2008 9:37 PM.

The previous post in this blog was Write Table content from Database to XML file.

The next post in this blog is Write a simple object to and from XML using C#.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle