Where should I put the logic for checking domain objects in my solution? Should I put them in the classes Domain, Business layer or something else?
I would also like to use this application block and policy implementation block from the Microsoft Enterprise Library.
What validation strategy should be used to fit all this well?
Thanks to everyone in advance!
It depends. First, you need to understand what you are checking.
You can confirm:
- , . (. " arent created equal" ).
Thing , , .
, , , .
, , .
- . .
.
, , , . , ( ). . , , (DRY). , .
( DI, , - ), (, , , , , - , ). ( , , , , ), . , . B.t.w. , , , , .
. , one.
. , - , , , , , , / ,
, POCO, , . , , , , IPropertyChanged, .
, , , IValidator, , .
public interface IValidator { IList<RuleViolation> GetViolations(); }
NHibernate Validation ( nhibernate ORM, . .
//I can't remember the exact syntax but it is very similar to this public class MyEntity { [NHibernateValidation(Length(min=1, max=10)] public String Name {get;set;} } //... and then later ... NHibernateValidator.Validate(myEntity);
: , , , NHibernate Validation
-, @i8abug.
, . , , , , .
, .
. , , . , . , , , . , , , , , .
, . . , 2 . ..: . ? . , .
, , "" , , , .. .
, . , , , . . , , . . , , . , , Inversion of Control ; ; , .
, , , , . "" - .
Source: https://habr.com/ru/post/1780345/More articles:string multiplication - javaAre common operator errors resolved in .NET 4? - genericsASP C #max-width in select tag not working in IE - htmlVS2010 Test Runner - unable to start agent process - visual-studio-2010Import android.os.ServiceManager could not be allowed - androidOnclick checkbox uncheck other checkboxes - javascriptSetting a breakpoint in a Rails 3 block (3.0.3) - ruby | fooobar.comMysqldump option to include column names in the first row - mysqlCan I find the IP address from which the image originated? - imageAll Articles