Sunday, 30 March 2014

Entity Framework (EF)


What is EF

Entity Framework (EF) is an object-relational mapper that enables .NET developers to work with relational data using domain-specific objects. It eliminates the need for most of the data-access code that developers usually need to write.
Entity Framework is actively developed by the Entity Framework team which is assigned to the Microsoft Open Tech Hub and in collaboration with a community of open source developers. Together we are dedicated to creating the best possible data access experience for .NET developers.

-------------------------------------------------------------------------------------------------

ADO.NET is a very strong framework for data access. ADO.NET has been around since many years and there are a lot of systems running over ADO.NET. Developers who are totally oblivious to the concept of ORMs will probably be asking "What is Entity Framework? What are the benefits of using it and is it an alternative to ADO.NET?"

Well, to answer the first question about what is Entity FrameworkEntity Framework is an Object Relational Mapper (ORM). It basically generates business objects and entities according to the database tables and provides the mechanism for:
  1. Performing basic CRUD (Create, Read, Update, Delete) operations.
  2. Easily managing "1 to 1", "1 to many", and "many to many" relationships.
  3. Ability to have inheritance relationships between entities.
and to answer the second question, the benefits are:
  1. We can have all data access logic written in higher level languages.
  2. The conceptual model can be represented in a better way by using relationships among entities.
  3. The underlying data store can be replaced without much overhead since all data access logic is present at a higher level.

Saturday, 4 January 2014

Uses and difference of verious ASP.NET Aspecial folders.


From ASP.NET 2.0 versions Microsoft provided 8 integration directories to integrate different resource in your application.


App_Code

App_code folder can contain source code for utility classes as well business objects (.cs, .vb and .jsl files). Classes that are present in App_Code folder are automatically complied when your web application complied.

Arbitrary file types can be placed in the App_Code folder to create strongly typed objects.

For example: placing Web service files (.wsdl and .xsd files) in the App_Code folder creates strongly typed proxies. Code present in App_Code is automatically referenced by ASP.net Application.

Note: Any another .cs/.vb class file(s) (other than page code behind file(s)) place outside App_code folder will ingored by compiler and will not compile. This behavior applicable to only ASP.NET websites and there is different behavior in web applications. These is different between a website and web application. Please keep this in mind.

App_Data

App_Data is used to store file that can be used as database files (.mdf and xml files) suas SQL Server 2005 Express Edition database, another database, or an XML data file that will be used in the Web site. When a new Web site is created the App_Data folder is created by default.

App_Data folder is used by ASP.NET application for storing ASP.NET application local database. Developers can also use this folder for storing data for their ASP.NET Application.

App_Browsers

ASP.net reserve this folder name for storing browser definition files. Browser definition files are used to determine the client browser capabilities. Browser definition files have .browser extension.

These files are often used to help support mobile application.

App_GlobalResources

App_GlobalResources folder contains resources (.resx and .resources files) that are compiled into assemblies and have a global scope.

Resource files are used to externalize text and images from your application code. This helps you to support multiple languages and design-time changes without recompilation of your source code.

Resource files are strongly typed and can be accessed programmatically.

App_LocalResources

App_LocalResources folder contains resources (.resx and .resources files). The same files that are being contained by App_GlobalResources but files located in this folder are only available to a particular project, web page, master page or web user control.

App_Themes

Contain subfolders that each defines a specific theme or look and feel for you Web site. A these consist of files (such as .skin, .css and image files) that defines the appearance of Web pages and controls.

App_WebReferences

Contains Web references files (.wsdl, .xsd, .disco, and .discomap files) that define references to Web services.

Bin

Bin folder contains compiled assemblies (.dll files) for code that you want to reference in your application. Assemblies in Bin folder are automatically reference in your application.

Special folders can be added to a Web site from the Visual Studio menu system. Typically this involves right-clicking the Web Application project and selecting Add ASP.NET folder.