Vous êtes sur la page 1sur 4

Epicor & Entity Framework

Epicor 10 has been built on Microsofts Entity Framework 4.0


Right now Epicor is not fully up-to-speed with Entity Framework Relationships and
my guess would be because there is a ton of "bad" data and orphaned records all
over the place when you are migrating from Epicor 8 or 9, therefore to avoid
Referential Integrity issues - it could not have been a complete LINQ to Entities
implementation.
If Epicor ever fully implements their Relationships in their Entity Models, one day in
BPMs will be able to avoid join's and simply use QuoteDtl.ShipTo.Name and EF
(Entity Framework) will handle the join's behind the scenes. But for now you must
make use of JOINS in LINQ.
Remember this: In Epicor 10 you are NOT working directly with the database. You
could have in a table a column called CustName and in your BPM (EDM) it could be
referenced as CustomerName.

Quick Crash Course on Entity Framework (Not Tied to


Epicor)

At Microsofts November 2009 Professional Developer Conference, the legendary


Don Box, a Distinguished Engineer at Microsoft, said If youre a .NET developer
Entity Framework is where were going. Were going. Were there. Get on board, its
time.
The ADO.NET Entity Framework has shifted into becoming Microsoft core data
access platform for building .NET applications.

A central benefit the Entity Framework is that it frees you from being concerned
with the structure of your database. All of your data access and storage is done
against a conceptual data model that reflects your own business objects.
An Entity Data Model (EDM) is a client-side data model and it is the core of the
Entity Framework. It is not the same as the database model, which belongs to the
database.
.NET is but one tool that uses an EDM. The next version of SQL Server will use an
EDM for Reporting Services and you will soon begin to see other Microsoft
applications that will adopt the EDM concept as well. In fact, you will find that
model-driven development in general is getting more and more attention from
Microsoft.
When working with the Entity Framework, you will implement an EDM that is
particular to the Entity Framework. In the Entity Framework, an EDM is represented
by a single XML file at design time that is split into a set three XML files at runtime,
only one of which represents a conceptual model.
The conceptual data model that the EDM describes is stored in an XML file whose
schema identifies the entities and their properties. Behind the conceptual schema
described in the EDM is another pair of XML files that map your data model back to
the database. One is an XML file that describes your database and other is a file
that provides the mapping between your conceptual model and the database.
The Entity Framework runtimes most prominent feature set and that which you are
likely to work with most often is referred to as Object Services. Object Services sits
on top of the Entity Framework stack, as shown in Figure 1-6, and provides the
functionality needed to work with objects that are based on your entities. Object
Services provides a class called Entity Object and can easily manage any class that
inherits from EntityObject. Object Services also provides serialization (both XML and
binary).
Object Services then uses the change-tracking information when its time to update
the data. It constructs Insert, Update and Delete commands for each object that has
been added, modified or deleted by comparing the original values to the current
values of the entity.

Entity Framework Data Model Crash Course


Well-designed database can pose a problem for developers. In the data world, a
database is designed for maintainability, security, efficiency and scalability. Its data
is organized in a way that satisfies the demand of good database design, yet
provides challenges for the developer who needs to access that data, at run-time,
the EDMX file is broken up into three separate XML files.
In the Entity Frameworks implementation of the EDM, the primary XML file
represents the conceptual model, which is the actual EDM. A second XML file
represents the database schema, and a third represents the mapping between the
first two. At design time, all three files are bundled into a single EDMX file. The build

process splits the EDMX out into the three metadata files that are used at runtime.
The Entity Framework then provides a framework that allows developers to
write.NET applications based on this model. As long as the EDM provides the
conceptual schema, a representation of the database, a mapping file, and access to
an Entity Framework-aware ADO.NET provider for the target database, the Entity
Framework doesnt care what database is being targeted. It provides a common
means of interacting with the database, common query syntax, and a common
method for sending changes back to the database.

Regenerate Data Model RE-Builds (but not limited to):


1. Creates / updates views in SQL dbo schema
2. Rebuilds the contents of the data model objects (Erp.Data.910100.dll and Ice.Data.Model.dll)

Vous aimerez peut-être aussi