What does the DRY principle look like in ASP.NET MVC?

I keep hearing about the DRY principle and how this is so important in ASP.NET MVC, but when I do research on Google, I don't seem to quite understand how this relates to MVC.

From what I read, this is not really the smell of code and the insertion of code that I thought was, but it is more.

Can any of you give an idea of ​​how I can use the DRY principle in my ASP.NET MVC application?

+5
source share
8 answers
  • use filter attributes to control aspects (authentication, navigation, crackers, etc.).
  • supertype ( , . mvccontrib )
  • actionresults (, mvccontrib - , logoutresult, FormsAuthentication.Logout()
  • - ,
+4

" ". , , , . , , , , , , .

+7

. . - . ASP.NET, MVC.

  • ++ Templating .
  • C void * , .
  • , .
  • . DRY.

"" . .

  • ?
  • .
  • , /.
+2

DRY . , ( /) , . , , , . , .

+1

MVC, , , - , , . , .

+1

DRY , . ? , ..

0

, , DRY UI, - , MasterPages UserControls.

MasterPages , HTML .

UserControls . , , , CRUD. , , , , . , . , ( ) .

DRY MVC - .

0

, , . , - , . :

: , ,

View Model: List, Table, Tuple, SearchFormBackingModel: , Outputoptions .. .

The Tuple / Dictonary / Map card may appear in separate instances of Account, Asset and PurchaseOrder, but the table may be useful for their collection, etc. You still have MVC, but you have session data that is not yet ready for transaction in the model view, without necessarily breaking the rules of your domain model, where the rules should go. They will be less anemic and anti-patterns. You can pass these rules in advance and use them there, or just in the back, or both, depending on how the system reads from clients, etc.

0
source

All Articles