I would have stuck with the default AR validation model probably.
Dan
On Fri, 16 Jun 2006 15:15:54 +0400, Craig Neuwirt <[EMAIL PROTECTED]>
wrote:
> I see. You also have a blended validation capability utilizing the
> existing
> AR records and supplemented with custom validation services. That is
> very
> nice. If you didn't have client specific validation needs, would you
> have
> done it any differently?
>
> thanks for your feedback
> craig
>
>
> On 6/15/06, Dan Bunea <[EMAIL PROTECTED]> wrote:
>>
>> In our product, some clients require customizations that may even regard
>> validation. For instance a client wants to validate name and productcode
>> for a product, another wants just the name. To be able to do this kind
>> of
>> customizations, we use the Windsor Ioc container and our business
>> services
>> are injected with the custom validators:
>>
>> public class ProductBusinessService
>> {
>> public ProductBusinessService(ProductValidationService validator)
>> {
>> this.validator= validator;
>> }
>>
>> ...
>>
>> public void Save(Product p)
>> {
>> validator.Validate(p);
>> p.Save();
>> }
>> }
>>
>> Our validation service, is a rewrite of
>> ActiveRecordValidationBase.CollectValidators, that does collect the
>> validators from the persistent class, but can also have others added to
>> it:
>>
>> public Product:ActiveRecordBase
>> {
>> [Property,ValidateNotEmpty]
>> public string Name
>> {
>> get...
>> set...
>> }
>> [Property]
>> public string ProductCode
>> {
>> get...
>> set...
>> }
>> }
>>
>>
>> and for the two clients:
>>
>> Client1:
>>
>> public class ProductValidationService:BaseValidationService
>> {
>> public ProductValidationService()
>> {
>> }
>> }
>>
>> Client 2:
>>
>> public class ProductValidationService:BaseValidationService
>> {
>> public ProductValidationService()
>> {
>> this.AddValidator(new NotEmpty("ProductCode"));
>> }
>> }
>>
>> That is what we did faced with the problem presented above, where the
>> validators in the model weren't enough.
>>
>> Thanks,
>> Dan Bunea
>> http://danbunea.blogspot.com
>>
>>
>>
>>
>> On Thu, 15 Jun 2006 15:40:20 +0400, Craig Neuwirt <[EMAIL PROTECTED]>
>> wrote:
>>
>> > I know AR promotes validation within the model. If you don't use AR,
>> do
>> > you
>> > usually still put validation in your models or directly in the
>> Business
>> > services or create a separate validation service. Just curous
>> >
>> >
>> > On 6/12/06, hammett <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Clarifying:
>> >>
>> >> - with or without AR I create a DA layer.
>> >> - I usually work with models. If I'm using AR then AR entities are my
>> >> models. I just don't like invoking FindAll, or Create on the
>> >> presentation layer, instead I use a service layer that is aware of
>> >> business rules and its implications, so if later I have to add some
>> >> logic say, everytime a Customer is created, I just need to change one
>> >> place
>> >> - The only time I've used a dataset was to process some reports,
>> where
>> >> the columns and aggregated columns were somewhat dinamically, and
>> >> more, the report was generated by a windows service to be viewed
>> >> later. For that situation only, DS was perfect. :-)
>> >>
>> >> On 6/12/06, Craig Neuwirt <[EMAIL PROTECTED]> wrote:
>> >> >
>> >> > One last ? on this thread. If you know you are not going to use
>> AR,
>> >> would
>> >> > you still create your Domain Model as AR Entities, or just pass
>> POCO
>> >> (or
>> >> a
>> >> > DataSet) to your DA Layer.
>> >> >
>> >> > thanks for your feedback
>> >> >
>> >> >
>> >> > On 6/12/06, hammett <[EMAIL PROTECTED]> wrote:
>> >> > >
>> >> > Yep.
>> >> >
>> >> > On 6/12/06, Craig Neuwirt <[EMAIL PROTECTED]> wrote:
>> >> > > Gotcha!, but you do pass the AR objects to your DA layer
>> interface.
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > hammett
>> >> > http://hammett.castleproject.org/
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> >
>> >> > CastleProject-users mailing list
>> >> > [email protected]
>> >> > https://lists.sourceforge.net/lists/listinfo/castleproject-users
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > CastleProject-users mailing list
>> >> > [email protected]
>> >> > https://lists.sourceforge.net/lists/listinfo/castleproject-users
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >> --
>> >> Cheers,
>> >> hammett
>> >> http://hammett.castleproject.org/
>> >>
>> >>
>> >> _______________________________________________
>> >> CastleProject-users mailing list
>> >> [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/castleproject-users
>> >>
>>
>>
>>
>> --
>>
>> Dan Bunea
>> http://danbunea.blogspot.com
>>
>>
>> _______________________________________________
>> CastleProject-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/castleproject-users
>>
--
Dan Bunea
http://danbunea.blogspot.com
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users