ASP.NET MVC website for Mobile using Oracle DB


This application provides a live demo of developing an asp.net mvc 2 web application using Oracle 11g as backend. The prerequisites of the lab is:

1. Microsoft Visual Studio 2010 (Ultimate, Premium, Professional) with .NET Framework 4.0

2. Microsoft Visual Studio 2008 (with MVC 2.0,3,0 plugins installed).

3. Oracle Data Provier (ODP.Net) for Visual Studio supporting entity Framework with Linq. Download here: http://www.oracle.com/technetwork/topics/dotnet/downloads/odacefbetainstallinstructions-302527.html

4. Oracle 11g.

5. Windows Phone 7 SDK , Opera Mobile Browser 11.e

The MVC application is build with Model, View , Controller infrastructure in ASP.Net Applications. Controllers present the code – behind logic like asp.net webforms where as view represents the UI layer. The model encapsulates the business logic & data embedded within the database.

  • To start the application click on visual studio File -> New -> Project – > Web.
  • Select ASP.NET MVC 2 website & select a name of your application.
  • Click on finish after providing Solution name, location.
  • Connect to Oracle database by providing the user name & password . To implement it click on view -> Server Explorer->Check the ODP.NET Add Connection.(Please note : if you have installed Oracle Data Provider for Visual studio for EF & Linq, it will open the ODP.Net Add connection property on clicking add connection property )
  • Select the DataSource Name . (Please Note: in case of Oracle local database provider residing on same computer , you can select ‘(Local Database)’ otherwise for remote database Select your data source name updated in ‘tnsnames.ora’ file.
  • Provide the user name & password & click on test connection button. If it connects successfully then the database will open in Server Explorer.
  • I have created the user ‘Scott’ in Oracle (Local Database) so I opened the tables of Scott user in Oracle. There are some in built tables in Scott users like EMP, DEPT. For this application I have used only the EMP table.
  • Right -Click on EMP table & select ‘Query Window’. write the following query in window.

Select* from EMP; 

Check the output of the query.

  • Start the ASP.NET MVC Project in Visual Studio.
  • Right-Click on Model folder & select ADO.NET Entity Model Framework.
  • Provide a suitable name for the .edmx file. For this project I have provided Employees.edmx.
  • Select the option ‘Select from Database’ Click on Next, Select the ‘Data Connection name’ in this case ‘SCOTT(Local Database)’ & check the radiobutton ‘yes , include sensitive information in connection string’ & check the connection string name in application configuration file.
  • Click on next & select the Model name & provide a suitable model name & select the table, View, Stored Procedure & click on finish.
  • The .edmx file will create the employees.edmx with datacontext  backend files.
  • Right Click on Controller folder select new Controller & provide a name ‘IndexController’ & click on Checkbox ‘Insert, Update, Details’.
  • Click ok & check the Index Controller.cs file.
  • Open the IndexController.cs file & modify it by just mentioning Index() method & creating a object of SCOTTEntities class. Comment out the rest of the code.
  • Build the solution first then right click on Index() method & select Add View to add a new Index view of the application.
  • Provide a name of the view as Index & select the checkbox ‘Create strongly typed view’ & View type select ‘details’.
  • Click finish. The index view will create the normal view with HTML codes.
  • Now click on ‘start Debugging’ or F5 to launch the application.
  • check the output in Opera Mobile emulator on ‘Samsung Galaxy Tab’ view or Windows Phone emulator.

Now the website is ready….

 

This slideshow requires JavaScript.

 

Advertisements

About Anindita
Anindita Basak is working as Big Data Cloud Consultant in Microsoft. Worked in multiple MNCs as Developer & Senior Developer on Microsoft Azure, Data Platform, IoT & BI , Data Visualization, Data warehousing & ETL & of course in Hadoop platform.She played both as FTE & v- employee in Azure platform teams of Microsoft.Passionate about .NET , Java, Python & Data Science. She is also an active Big Data & Cloud Trainer & would love share her experience in IT Training Industry. She is an author, forum contributor, blogger & technical reviewer of various books on Big Data Hadoop, HDInsight, IoT & Data Science, SQL Server PDW & PowerBI.

3 Responses to ASP.NET MVC website for Mobile using Oracle DB

  1. This genuinely addressed my issue, thank you so much!

  2. Pingback: please click the up coming post

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: