Monday, 12 November 2012

Entity Framwork CSDL,SSDL,MSL ?


Entity Framework:

In Entity Framework we know CSDL,SSDL,MSL parts each hirerchy implies a specific reasons:

Conceptual Model (CSDL)

Conceptual model specifies logical names [not physical name—storage model]

the what are type(Entities available in the database and their associations and Primary keys).

EntitySet--à  Logicalname; Example : adding s to endof the entity

EX:

Order---Orders
Employee---Employees

<edmx:ConceptualModels>
      <Schema Namespace="NORTHWNDModel" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="NorthwindEntities" annotation:LazyLoadingEnabled="true">
          <EntitySet Name="Categories" EntityType="NORTHWNDModel.Category" />
</edmx:ConceptualModels>


Storage Model

Storage model specifies the physical names of the database. Which is coupled with the apporiate databse.

storage model---Physical names of the entities. And their relation-ships.

  <edmx:StorageModels>
      <Schema Namespace="NORTHWNDModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="NORTHWNDModelStoreContainer">
          <EntitySet Name="Categories" EntityType="NORTHWNDModel.Store.Categories" store:Type="Tables" Schema="dbo" />

  </edmx:StorageModels>


Mapping Model

Speicifies the relations between CSDL <à SSDL



Why conceptual model specifies-à Associations and Primary keys Even we have the Storage model

Yes, Conceptual model specifies -à Conceptual model specifies the objects as application prospecitive.

While performing the operations-à developer can easily now the relations between entitysets. So developer can write the code without violating the rules of database.

And developer can divide the sub entities as per his requirements and relationships between the entities of in the conceptual model or logical view.

like
Dataset (EF—CSDL)---Maintains----Primary key and Foreign key relationships.--> developer can easily maintain relations with good relational data without distributing the database relations.

Can Conceptual model maps multiple Storage models?

Yes,single conceptual maps multiple storage models.

Conceptual model ---à application prospecitive.

Storage model------à database prospecitive.

In Entity Framework developer always works with conceptual model without knowing database and their relationships because of conceptual model.



http://www.simple-talk.com/dotnet/.net-framework/entity-framework-the-cribsheet/#_Toc199587378

No comments:

Post a Comment