Using Informix and the Entity Framework

brawnywinderΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

128 εμφανίσεις

2010 IIUG Informix Conference
Michael C. Payne
The Rawlings Company
Using Informix and the Entity Framework
Session: B08
Tuesday, April 27, 2010: 09:10 - 10:10
2010 IIUG Informix Conference
Slide 2
What is the Entity Framework?
• Entity Framework was first released by Microsoft in .NET 3.5 SP1
(8/2008)
• It separates the logical schema of the database from the conceptual
needs of an application
• It’s Visual Studio built in ORM
• It’s supported by LINQ
• Relationships are exposed as properties
• Allows for compile time type information, so you get errors when
assigning values during development not when your users run the
application
• Defined as a partial class so the underlying DB can change but custom
extension code is unaffected.
• Facilitates “fancy” interaction with the database (i.e. to get the third
page of 10 records you can do query.Skip(20).Take(10); or quering
across relationships without knowing about joins)
• Shifts processing to the client

Through LINQ data interactions are the same regardless of the
underlying database / XML / Object / etc. platform
2010 IIUG Informix Conference
Informix and the Entity Framework
• Requires DRDA – Distributed Relational Database Architecture a
database interoperability standard from The Open Group
• Works on Informix v11.1 and later
• Needs a different driver from the Informix Client SDK, the lightest
one is IBM® Data Server Driver for ODBC, CLI, and .NET, Version
9.5.3 or later
• You also need to install IBM Database Add-ins for Visual Studio

Needs transactions enabled on the database for writes
Slide 3
2010 IIUG Informix Conference
Installing DRDA

When setting up DRDA be sure to check “Enterprise Replication”
and “Global Language Support” on the database setup, these can
be added later to existing implementations
Slide 4
2010 IIUG Informix Conference
Creating the Entity Data Model
• Demo in Visual Studio
Slide 5
2010 IIUG Informix Conference
Generate Entity Directly from Database
Slide 6
2010 IIUG Informix Conference
Create a connection
Slide 7
2010 IIUG Informix Conference
Establish Connection
Slide 8
2010 IIUG Informix Conference
Slide 9
2010 IIUG Informix Conference
Slide 10
2010 IIUG Informix Conference
Show Dynamic Data Website
Slide 11
2010 IIUG Informix Conference
Add Customer Call Information
Slide 12
2010 IIUG Informix Conference
Hand Coding the EF in XML
Slide 13
2010 IIUG Informix Conference
Things to watch out for
• The underscore “_” causes problems for automatic mapping of
Entity Framework
• Some kinks with the built in functions exists, for example using
StartsWith(“Lud”) will generate a SQL query that looks like the
following. This query will fall off index. If you have a poor
performing step, check the SQL that EF generates and try to rework
it.
– select fname, lname from customer where substr(lname,1,3) = ‘Lud’
• Establish referential integrity before trying to use EF against your
database.
• Be careful with some of the auto-generated tables. You still need to
watch security and business rules.
Slide 14
2010 IIUG Informix Conference
Slide 15
Using Informix and the Entity
Framework
Michael C. Payne
mcp@rawlingscompany.com