Tuesday, December 22, 2009
Sunday, February 22, 2009
Let us take a small example, suppose we have a table 'Person' that is linked with 'PersonalDetails' and 'SalesPerson'.
Using the above scheme, if we need to retrieve a set of SalesPerson along with their personal detils then the query will be like this:
SELECT SalesPerson.*, PersonalDetails.*, Person.* FROM Person INNER JOIN PersonalDetails ON Person.PersonID = PersonalDetails.PersonID INNER JOIN SalesPerson ON Person.PersonID = SalesPerson.PersonID
Now u, if we had option to change the shema in order to suite our coding and if we can convert it to something like this:
Here all the fields of PersonalDetails are the part of Person and SalesPerson entity is getting derived from Person, very much similar as in Object Model.
Now the LINQ query to fetch the data will be:
from p in People.OfType<salesperson> select p
This is the simple example of how the Entity Framework can remove the pain of having not only to interact with the database, but also to translate the tabular data into objects.
When working with the Entity Framework, you will use a particular implementation of an EDM. In the Entity Framework, an EDM is represented by an EDMX file at design time that is split into a set of three XML files at runtime.
We will cover three xml files in our next section
Monday, February 16, 2009
With the Entity framework, we do not query against the schema of the database , but rather against a schema that represents or reflects our business model.
So the very first question comes into our mind is ..'What the benefit of Entity Model over Relation database shema?'
The Entity Framework does the retrival, storing part of the job for you, similar to the way an Object Relational Mapping tool works.
It retrievs the data as object. You work on that object and save the object. EM (Entity Model) itself converts the object to rows and columns and save the data to database.
Not only saving data to database, EM also maintains relationships between tables (called Entity) . Relationship can be as Association like one to one, one to many and even many to many, inheritance etc.
So you can store data to various tables if you create instance of one entity (table) and that entity have reference to various other entities.
In next blog, I will show an example to clear this logic.
Programming Entity Framework is a thorough introduction to Microsoft's new core framework for modeling and accessing data in .NET applications. This blog help users to get indepth knowledge of Entity framework
Developers spend far too much time worrying about their backend database, its tables and their relationships, the names and parameters of stored procedures and views, as well as the schema of the data that they return. Microsoft's new Entity Framework changes the game for .NET developers so that we no longer have to be concerned with the details of the data store as we write our applications. We can focus on the task of writing our applications, rather than accessing the data.
The ADO.NET Entity Framework is a new data access platform from Microsoft for writing .NET applications. It was released in July 2008 as part of the Visual Studio Service Pack 1 and .NET 3.5 Service Pack 1, two years after Microsoft announced it at its TechEd 2006 Conference.
Although the existing data access features remain in ADO.NET, this new framework is part of Microsoft's core data access strategy going forward. Therefore, the Entity Framework will receive the bulk of the innovation and resources from Microsoft's Data Programmability team. It's an important technology for Microsoft, and one that you should not ignore.
Why do we need a new data access technology? After many years of forcing developers to switch from DAO to RDO to ADO and then to ADO.NET, with ADO.NET it seemed that Microsoft had finally settled on a tool in which we could make a big investment. As Visual Studio and the .NET Framework have evolved, ADO.NET has evolved by enhancement and addition, but has remained backward compatible all along. Our investment was safe.
And it remains safe. The Entity Framework is another enhancement to ADO.NET, giving developers an added mechanism for accessing data and working with the results in addition to DataReaders and DataSets.
One of the core benefits of the Entity Framework is that you don't have to be concerned with the structure of your database. All of your data access and storage are done against a conceptual data model that reflects your own business objects.