Hello,
I have a question regarding separation of business logic and the db generic.
I have created a vb manager template based on the c# one that is floating around, and I finally have time to update it to 2.0.
In my 1.X version every time an Entity, or EntityCollection instance was created i would set the EntityValidatorToUse, additionally in saves and update i would make sure that the validator was set. This wasn't ideal, but it worked. The biggest problem is recursive saves, and making sure the entire tree has the validator set.
So in 2.0 i am happy to see that the validation is combined into 1 class. Also I am happy to see the Overridable CreateValidator in the Entity, which will ensure that i have the validator set every time. (I'm happy about a lot of 2.0 stuff, I could go on all day, thanks Frans.)
So here is my problem I think that validation is business logic and should be in my manager project, with the other business logic. The extreme case for this argument is when during validation on an entity you need to look up something in the db, possibly other entities in order to determine if the entity being validated is valid. For example when validating orderdetail you need to confirm the price that was specified, or some other business logic stored in the db.
Please let me know if anyone feels i am out of line here, maybe validation shouldn't go this far. Maybe the db look up validation stuff should be in my manager save, but what about recursive saves, where the save is performed implicitly w/o using my manager save, I think that is the elegance of the built in validator.
Ok, no problem just inherit from ValidatorBase and put classes in the business/manager layer. I agree, however generic doesn't have a reference to business. so i can't just say in CreateValidator use Business.SomeValidator, I have to do something like create a global/application dll that can act as the middleman so generic doesn't need to see business.
I'm sure others have come up with good solutions for validation, let me know if you have questions or ideas. I appreciate any input.
Thanks,
Gabe