C#.Net is a programming language which is extension of C language concepts.So it contains class programming obviously.Now,what is the class in C#.Net and how to use it ?
First of all Class is a group of variables and functions as we know,but in web technology we can not elaborate class as like this,we have to explain actual usage of particular class.
So,basically class includes following features.
1) Structured programming
3) Re-usability of code
In C#.Net i have created three classes as per figure and give it to name Property,Business and Data respectively.You can give any name to the class as per your convenience.
However,Property class contains only member definitions which are to be used in website coding.Variables defined in this class we can use directly within the complete programming of website.We don't need to declare again.For example,
Public int product_id;
The second part is Business class which is to be considered as intermediate class between Property and Data classes.It passes data of Asp.Net page to the data class via function and parameters.For example,
Public void Intersave(Property p1)
Data d1=new Data //creating object of data class to pass values.
d1.Insertdata(p1); //using object of Property class to pass the actual value of variable.
It also consists business logic as well as restrictions in business logic.Whatever information we need to pass to the user we can pass through this class and remaining information we can restrict.
The third and last class is Data class which contains actual coding which means queries and coding to perform operations with database.For example,
Public void Insertdata(Property p1)
Sqlconnection conn=new Sqlconnection("Connection String");
All classes are included in App_Code folder in Visual Studio environment.Finally,all classes are converted into .dll file which is completely secure and very difficult to access.We can easily reuse same functions in different web pages,we don't need to write same code again which gives us speed execution and less memory requirement.