Have a look at below link for information on "Object-relational mapping
Below are some of the ORM
based Technologies/Techniques compatible with .Net.
Quote:1. Why we need to create classes for every table and how to implement them.
From above links you will get an idea that "ORM
" is "Object-relational mapping" Data-Access technique. In this you perform your Data-Access operations on Objects/Lists instead of directly on Database Tables. This is the reason you require Classes which represent your Database Tables, and Properties/Fields which represents your DB Table Columns. These Classes generally called as Entity Classes. In "NHibernate
" you require to write these Entity Classes manually, but in "Entity Framework
" they are created automatically.
But still Question is Why to perform Data-Access operations on Classes/Objects.
Answer - Few benefits of this.
1) This keeps your Data-Access logic/code RDBMS independent. Today you might be using MySQL and tomorrow you may decide to use any other RDBMS, in this case your Data-Access logic will remain unchanged. Only you may require to do some setting changes in your configuration file.
2) In this Unit-Testing of your Data-Access using NUnit or other Unit-Testing Technology is more efficient.
Quote:"How to make connection to MySql using Linq and query directly to MySql".
You may refer below similar Question-Answer discussion for this.
Linq to MySql. DML operations