Devart offers you to try Entity Framework functionality of dotConnect for Oracle
with Entity Framework Query Samples.
The Entity Framework Query Samples application
is a test framework for different databases and data providers within ADO.NET Entity
Framework. It is intended to help you learn the features of the different query
languages available in the Entity Framework, and to let you visualize how the results
and the translated store queries look like.
This package is based on the original work by Microsoft available here: http://code.msdn.microsoft.com/EFQuerySamples.
Oracle 22.214.171.124 or higher is required for Entity Framework Query Samples. To connect
to Oracle, you need a Trial or Professional version of the dotConnect for Oracle
installed on your system. ADO.NET Entity Framework requires .NET Framework 3.5 Service
Pack 1 installed. Visual Studio 2008 Service Pack 1 is required to compile the sample.
First, create a new copy of the NortwhindEF database. The sample contains the DB
folder, which includes subfolders for every database with scripts or ready-to-use
Second, open the App.config file and change connection strings for the databases
you are going to use.
After that, you can compile and run the sample.
There are 2 ways to run samples: the interactive mode and batch mode.
To run samples in the interactive mode, compile and run the project without any
command-line arguments. Using the tree on the left-hand side, locate a sample you
are interested in and click Run. You can run samples against different providers,
by selecting them from the drop-down menu.
To run samples in the batch mode, run "SampleQueries.exe /runall /pause". It will
open the console where each sample is executed sequentially and any exceptions are
You can also pass "/log filename.txt" which will save results of all samples to
a file. To specify a different provider, pass "/connectionString cs", where "cs"
is the name of the connection string defined in "SampleQueries.exe.config"
SampleQueries.exe /log log.txt /connectionString "NorthwindEF (Oracle)" /runall
Oracle does not support some keywords in SQL statements, such as EXCEPT.
Therefore, some queries that are translated to SQL using these keywords fail (some
tests for relational and set operators).
You can build the same model yourself with
Entity Developer. To build the model, perform the following steps.
After you have created the required database, run Entity Developer and import the
database to the model. To do it, perform the following steps.
The New Project page is displayed.
The Entity Developer: Create Model Wizard page is displayed.
The Set up data connection properties page is displayed.
The Choose Model Contents page is displayed.
The Select Database Objects page is displayed.
The Set up naming rules page is displayed.
The Model properties page is displayed.
The Choose Model Diagram Contents page is displayed.
The Choose Code Generation Template page is displayed.
The Entity Developer: Create Model Wizard final page is displayed.
Now we have the model, but it is not the same as Entity Framework Query Samples
Model. It is not possible to create inheritances and complex types automatically
from the database, we should create them manually.
Let's create complex type CommonAddress instead of the Address, City, Region, PostalCode,
and Country properties. To do this, perform the following steps:
After this, we should remap these properties in the Customer, Supplier, Order, and
PreviousEmployee classes to the CommonAddress complex type. Perform the following
Now let's create inheritance relationships like in the Entity Framework Query Samples
Model. This model contains three types of inheritances: Table Per Type with Order
and InternationalOrder classes, Table Per Hierarchy with Product and DiscontinuedProduct
classes, and Table Per Concrete type with Employee, CurrentEmployee, and PreviousEmployee
In Table Per Concrete type hierarchy each non-abstract hierarchy class is mapped
to one table. CurrentEmployee is mapped to the Employee table, PreviousEmployee
class is mapped to the PreviousEmployee table. They have the same parent abstract
class Employee. To create Table Per Concrete type hierarchy, perform the following
The Class Editor dialog box is displayed.
In the Table Per Type hierarchy, each hierarchy class is mapped to one table. The
Order class is mapped to the Order table, the InternationalOrder class is mapped
to the InternationalOrder table. To create the Table Per Type hierarchy, perform
the folowing steps:
In the Table Per Hierarchy hierarchy, all hierarchy classes are mapped to the same
table. To create the Table Per Hierarchy hierarchy, perform the folowing steps:
Now we have almost the same model as Entity Framework Query Samples Model. All we
need to change is to assign these methods to Employee insert, update, and delete
actions. Perform the following steps to complete Entity Framework Query Samples
Now look at the Error List window. It displays error messages and warnings of your
model. After we configured the behavior of the CurrentEmployee class, the following
error is displayed: "If an EntitySet mapping includes a function binding,
function bindings must be included for all types. The following types do not have
function bindings: NorthwindEFModel.PreviousEmployee." This error means
that if we assigned functions to insert, update, and delete operations for one hierarchy
class, we should do the same for all non-abstract classes in the hierarchy.
So we will create the stub function and assign it to insert, update, and delete
the operations of the PreviousEmployee class.
The model is complete now. Let's generate code for it. Perform the following steps
to generate the code.
The context and entities are successfully generated and stored in the specified
See how to use Code-First in dotConnect for Oracle.
Try our Entity Framework support on Entity Framework Query Samples application.
Try our Entity Framework Spatials support for Oracle, PostgreSQL, and MySQL