How can I speed up the development of an MVC4 DEVELOPMENT application?

I know this sound is strange - let me explain:

I am currently developing a standard database web application. I decided to use the IoC (Ninject) infrastructure, Entity Code First, Bootstrap, and several other related technologies. I rewrote the database model in UML, and now I'm trying to implement it, step by step. This usually happens as follows:

  • Select a function to implement.
  • Check which database tables are needed.
  • Create the appropriate POCO classes
  • Create a new database using the migration tool
  • Create all the necessary CRUD methods that are required. (I know that I have to create unit tests, but there is simply no time: /)

The first question is - do you look β€œnormal” to you? Perhaps I missed something that could accelerate my development? Or maybe I should add a few more steps - for example - to catch more errors early on?

Now the next step is to create the Views, so I'm doing something like this:

  • Create a ViewMethod inside the appropriate controller.
  • Create a ViewModel based on one or more POCO database classes
  • Create editor templates for my new ViewModel
  • Creating function logic inside the controller.

The problem with the above approach is as follows:

  • I often have to create almost a duplicate of a POCO object, then - during the save procedure, I need to convert it back to the corresponding POCO objects, as usual:

    PocoEntity1 pocoEntity1 = new ()
    {
        UserName = ViewModel.UserName,
        UserPicture  = ViewModel.UserPicture
        (and so on)
    } 
    

- , POCO , , :

[Required]
[StringLength(128)]
[DisplayNameLocalizer("FirstName", typeof(TranslationStrings))]

( , ).

- - " "? , -, ViewModelEntity POCO, . -, , , , ?

+4
2

... "" ?

. Unit. " unit test" . , .

: unit test, . , , , .

  • , .

2. 4. . , " " (... ). .

POCO, - , POCO , :

PocoEntity1 pocoEntity1 = new () 
{ 
  UserName = ViewModel.UserName,
  UserPicture = ViewModel.UserPicture 
  (and so on) 
}

, . .. . AutoMapper ( nuget)

- POCO , , :

[...]

( , ).

: (MVC)

. - .

+3

, - , MVC , POC, . , , .

"", . viewmodel POCO, , ​​ AutoMapper. - ( ):

[HttpPost]
public ActionResult Edit(int id, YourViewModel model)
{
    if (ModelState.IsValid)
    {
        var poco = repository.getPoco(id);
        Mapper.Map<YourViewModel, YourPoco>(model, poco);
        repository.Save();
        return RedirectToAction("List");
    }
    return View(model)
}
+4

All Articles