MM .NET integrates with Microsofts Entity Framework. Howver, if
you prefer to use classic ADO.NET, you can use MM .NET' "classic" entity
objects. These entity objects are mostly comprised of
properties that represent the attributes
of real-world entities and provide
strongly typed access to data associated
with a business object. Entity objects
are very light weight and serializable
so they can be passed between physical
tiers of an n-tier application.
Here is an example of an
EmployeeEntity object:

The Problem with
Untyped Data
By default, data
access in ADO.NET is untyped and fraught
with potential run-time exceptions. Take
for example the following line of code:
string
CustomerID = (string)Row["CustomerID"];
The first thing to
note is that "CustomerID" is a string
that is evaluated at run time. If you
mistype the column name, (for example, "CustID"),
the compiler will not catch the error
and you will get a run time exception
when this line of code executes.
The second thing to
note is the explicit cast to a string.
When you perform an explicit cast, the
compiler assumes you know what you're
doing. So, if you incorrectly specify
the type as shown in the following line
of code:
int
CustomerID = (int)Row["CustomerID"];
the compiler will not
catch the error, and you will get a run
time exception.
The Benefits of
Typed Data
When using MM .NET
Entity objects, you solve both of the
problems mentioned above. Take for
example the following line of code:
string CustomerID =
OrderEntity.CustomerID;
In this case,
CustomerID is a property on an object,
so Visual Studio IntelliSense shows you
a list of OrderEntity properties to
choose from (you no longer have to go to
the Server Explorer to see what the
table column names are):

Even if you have
ignore IntelliSense and have a typo on
the property name, the compiler will
catch the error at compile time rather
than run time.
Also, when it comes
to strong typing, the compiler will also
catch an error where you specify the
wrong type:
string CustomerID =
OrderEntity.CustomerID;
In summary, MM .NET
Entity objects allow you to write code
that can be verified by the compiler to
help avoid runtime exceptions!
Back to
Feature List
|