Page 1 of 1

How to use DC for Oracle with ASP.NET MVC

Posted: Fri 26 Feb 2010 18:21
by HDumas
Hello,
I have been using the ODAC components with Delphi 7 since 2003.
We are now going to develop web applications with ASP.net MVC using the Entity Framework. When I saw that Devart was making components for Visual Studio and they were compatible with the Entity Framework, we decided to buy them... thinking it would save me a lot of time because I knew the ODAC so well. Unfortunately, it has not been so dreamy.
I have created the DataBase and generated the Model from this DataBase but I cannot seem to be able to work with this.
I am used to ODAC TOraQuery where I do not have to use a table exactly as is... I don't seem to be able to add Entities to my model that would have the columns I want from the tables I want...
I have looked at the tutorials and the demos that come with the DC for Oracle and I can't seem to make any sense of them. The queries there don't even seem to use the SQL Language from Oracle.
Where do I start?? Would someone have a demo that uses MVC framework and the Entity Framework... Thank you.

Posted: Mon 01 Mar 2010 09:48
by AndreyR
In the following links you will find a couple of tutorials.
The first one shows how to create an ADO.NET Entity data model using Devart dotConnect for Oracle.
http://www.devart.com/dotconnect/oracle ... al_ef.html
The second one is a Microsoft tutorial illustrating the process of creating a simple MVC application.
http://www.asp.net/(S(ywiyuluxr3qb2dfva1z5lgeg))/learn/mvc/tutorial-16-cs.aspx

Posted: Mon 01 Mar 2010 14:21
by HDumas
thank you very much Andrew for replying to this post.
I have done the 80 minute video MVC tutorial on the ASP.net website.
When I did the Devart Tutorial on the Entity Framework it did not work AS IS... Unfortunately, when I tried to connect to CRM_DEMO, it gave me an error that the "target host or object does not exist"... So I did the tutorial connecting to one of our own databases and it worked.
Now that I was connected to our employee database, I decide to continue and create a web application that lists all employees... And it works, IF I want to show the employee table AS IS... but this is not the case. I need to create a select that will use DECODE and CASE and PROC to calculate fields.
I want to know how I can, with DocConnect for Oracle, add a query to the Entity Data MOdel of my application and use this query to show in lists. Is there a demo or tutorial with DocConnect that shows how to use queries and not tables.
Also, when I open the demos that come with the DotConnect for Oracle, I find that the language use in select are NOT the same language used when querying directly in Oracle with SQL Plus... Where as before, with the ODAC components, I could make my queries work in Oracle and just copy it to my TOraQuery in Delphi. This does not seem to be the case anymore... Is there a dictionnary I can find to help me with this new language for making queries.

Others in the office are using nHibernate and we bought the DotConnect for Oracle thinking we would not be needing this nhibernate and it would be easier to use since we have all this experience with ODAC and Delphi. Maybe this was not the case??

Posted: Tue 02 Mar 2010 13:15
by AndreyR
If you are using Entity Framework (just like any other ORM) you should be ready to the fact that usage of plain SQL will be limited.
There are several options for you here:
1. Create a model and then map all entities using DefiningQueries and all CUD actions using stored procedures.
This way will save you a lot of work (you already have all queries) but it buries the entire idea of ORM.
2. Create a model from the database structure and then write LINQ to Entities (or Entity SQL) queries to obtain data.
Let the CUD operations to be submitted using the EF mechanism. This option needs some time
to learn new technologies like LINQ or ESQL, but this knowledge will be useful in common .NET world.

Posted: Tue 02 Mar 2010 14:48
by HDumas
Thank you very much... I'll look into that...
maybe EF is not the way to go for us...