asp.net mvc - Implementing application logic on model layer (MVC) -


i keep reading biggest layer in mvc pattern should model. i've heard should avoid putting logic on controller layer. however, asp.net mvc 5 application getting larger, see i'm getting heavy views, heavy controllers, and... extremely tiny models (they're not more references sql tables).

yes, admit, never manage put logic on model.

i mvc pattern, , website working good, keep on thinking i'm surely not doing things right...

can show me useful links how write mvc code properly? rick anderson's (microsoft) mvc 5 tutorial fine, once again, models indeed tiny...

in applications put logic possible in domain models. on top of there application layer interacts database , domain models perform application specific operations. controller actions have little code possible , call methods in application layer.

in addition have view model each view. logic have making views "heavy" go there.

one of main reasons try put logic possible in domain models make unit testing easier. logic in application layer involves database, need mock in order test. moving logic domain models makes testing easier , makes code more reusable.

this pretty complex issue. have in depth blog post on question if you're interested.

this answer pretty close suggest.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -