Markus, I know you've been busy with the release. Have you had a chance to think about this?
I have an edit to make my question more clear: "Can you think of a reason ActiveRecordModelBuilder is adding validators to the model, when the model's validators collection isn't used during validation?" -rb -----Original Message----- From: G. Richard Bellamy [mailto:[email protected]] Sent: Wednesday, January 13, 2010 3:16 PM To: [email protected] Subject: RE: NotSupportedException when ValidateGroupNotEmpty attribute is used in ActiveRecord class Markus, Is there a particular reason ActiveRecordModelBuilder is adding validators to the model, when those validators aren't then used during validation? The reason I ask is that it's calling the Build() method of the AbstractValidationAttribute, and that's what's throwing this exception. The ValidateGroupNotEmpty attribute requires an instance, and Build() has no access to that, and neither would ActiveRecordModelBuilder. Does the model builder ever need to concern itself with Validation attributes? IIRC, NH Validation is a consumer of the model mappings, rather than a part of the generation of those mappings, so it doesn't participate in the mapping process either. Let me know if I'm way off base here. -rb -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Bogdan Rogalski Sent: Wednesday, January 13, 2010 10:03 AM To: [email protected] Subject: NotSupportedException when ValidateGroupNotEmpty attribute is used in ActiveRecord class Hi, when I use the 'ValidateGroupNotEmpty' attribute on a ActiveRecord class I get this exception: System.NotSupportedException: You must call Build with a type parameter That's how my attribute looks like: [ValidateGroupNotEmpty("ProductOrTeam", "Select Product or Team")] [BelongsTo("ProductId",NotNull=false)] public Product Product { get { return product; } set { product = value; } } The exception is not thrown when I use it in my model view class that is not an ActiveRecord class. Any ideas how I can get ValidateGroupNotEmpty attribute to work on my ActiveRecord classes as well? Thanks, Bogdan Rogalski error source: ActiveRecordStarter.Initialize(Assembly.Load("ProductWarehouse.Core"), ActiveRecordSectionHandler.Instance); here is the partial stack trace: [NotSupportedException: You must call Build with a type parameter] Castle.Components.Validator.ValidateGroupNotEmptyAttribute.Build() +82 Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder.ProcessPrope rties(Type type, ActiveRecordModel model) +589 Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder.PopulateMode l(ActiveRecordModel model, Type type) +168 Castle.ActiveRecord.Framework.Internal.ActiveRecordModelBuilder.Create(Type type) +255
-- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
