Monthly Archives: March 2013

Web API CONTROLLER WITH MULTIPLE GETS

You might think that ApiController in ASP.NET  MVC will support multiple GET methods out of box, surprisingly it does not.

For more details, refer to my Open source security project on CodePlex at http://applicationsecurity.codeplex.com/

 

Let us take simple example, you are planning to abstract all user management related logic in a REST service. Your controller might look like this:

image

And you want to call your VerifyUser passing all the parameters. Let us see what happens…

SNAGHTML9d75d30

You are planning to add more methods like LogOff, ResetPassword etc. What do you do?

Solution is simple: You need to add an additional routing BEFORE your default routing as follows:

image

Let us what happens now:

SNAGHTML9dc933d

In order to solve this problem, you need to make the following change in your controller:

image

 

Now the final response

SNAGHTML9e7c9a8

UP AND RUNNING WITH ENTITY FRAMEWORK AND ORACLE

We are helping a healthcare client where they have large oracle implementation. We are moving from legacy client server applications to web based applications. We are successfully able to use Microsoft’s Entity Framework 5.0 with Oracle.

Since I am seeing so many hits on my blogs related to this topic, I will create one more useful blog on the same topic.

STEP #1

First you need to setup your development environment with Visual Studio 2012/2010 and install all the latest tools (MVC 4.0, NuGet Manager etc.)

STEP #2

Download and install Oracle Developer tools. This will install the Entity Framework provider that you can use with Visual Studio. Do not forget to install this not only on your development machine, but also on every machine your application needs to run.

You can download this from Oracle website here

http://www.oracle.com/technetwork/database/windows/downloads/index-101290.html

 

image

 

STEP #3

Add/Edit connection information

image

 

STEP #4:

Select all your schemas, otherwise tables you need won’t show up in the browser to select (to be added on to the EF designer).

image

Tagged ,