I am new to ASP.NET MVC 4 and Web API.
What I want to achieve is to create a CRUD web application that is able to manipulate the data tables in a simple existing SQL Server 2008 database.
I thought about the new MVC 4 with Web API and Entity Framework. There are a number of samples and examples about code first data access pattern but very few about database first.
Can anyone help with any brief idea how to achieve this with database first and Entity Framework and repository pattern please?
I started down this path a few months ago: learning ASP.Net, MVC3, using an existing database to build an App.
This is what I found (I’m happy to be corrected):
Don’t learn VB, learn C#. There are very few VB samples around.
I followed a ‘database first’ tutorial. There are many tutorials on the web, just get started and follow one and don’t be afraid to start over
If you want anything remotely flashy you need to use JQuery – this is basically a javascript library. MVC / ASP.Net offers very little in the way of interactive grids and pages.
It turns out that MVC is a bit of a misnomer. Often you need 5 layers, not 3:
Model (The M in MVC, generally generated for you by some code generation tool like Entity Framework, maps directly to tables)
ViewModel (wrapper classes around your autogenereated table classes that add more useful data) – this post is where I came accross them:
MVC dbContext find parent record when current record has no elements
Controller (The C in MVC)
View (The View in MVC)
Javascript (If you want anything beyond a basic HTML form, like a gird or a date picker you need to use javascript)
Like I say I’m happy to be corrected on any of these points. This is just my viewpoint at this stage of my journey. I have to say I have only investigate jqGrid as a grid solution and I’m just about ready to try something else.