Alexej Haak
Alexej Haak

Reputation: 480

ASP.Net MVC 4, CodeFirst and Azure Service

I've got a MVC 4 Website which uses CodeFirst.

I want to interact with the same database/model in an WebService and I have some problems which design approach I should take here? I've tried referencing my MVC 4 Solution and the EntityFramework.dll in the Webservice.. that doesn't work and also does not seem to be a good way of doing it.

can anyone give me a good starting point how to do this?

Upvotes: 0

Views: 195

Answers (1)

Thiago Custodio
Thiago Custodio

Reputation: 18387

Since you already have a DB, you could use Database First strategy:

http://msdn.microsoft.com/en-us/data/jj206878.aspx

But if you want to use Code fist, here's a good resource:

http://msdn.microsoft.com/en-us/data/jj200620.aspx

Just pay attention with the DB Initializer, since you already have a DB, you must not use "DropCreateDatabaseAlways" neither "DropCreateDatabaseWhenModelChanges". You should use Migrations to control changes to DB.

http://www.codeguru.com/csharp/article.php/c19999/Understanding-Database-Initializers-in-Entity-Framework-Code-First.htm

Upvotes: 1

Related Questions