Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

asp.net mvc - Domain object validation vs view model validation -


i using asp.net mvc 3 , using fluentvalidation validate view models. little concerned might not on correct track. far know, model validation should done on domain object. mvc might have multiple view models similar needs validation. happens if property domain object occurs in more 1 view model? validating same property twice, , might not in sync. if have user domain object validation on object. happens if have useraviewmodel , userbviewmodel, multiple validations needs done.

in news class have property called title, required field. on view model have title property, use automapper map news , newsviewmodel. validation happening twice. when domain model validation occur , when view model validation occur?

the scenario above example, please don't critise on it.

it's subtle distinction validation on view model validate correct user input , forms anti-corruption layer domain model, whereas "validation" on domain model enforces business rules. normal , should have validation on both layers. in fact may feasible useraviewmodel has different input validation userbviewmodel. question, try avoid exposing domain objects through viewmodel , instead map between them (often using automapper), way viewmodels anticorruption layers rather property bags of domain models. hope helps.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -