User: cneuwirt
Date: 2009/11/20 09:49 AM

Modified:
 
/Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter.Tests/
  AssemblyInfo.cs
 /Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/
  AssemblyInfo.cs, DictionaryAdapterBase.Validate.cs, 
DictionaryValidateGroup.cs, IDictionaryValidate.cs
 
/Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/Attributes/
  GroupAttribute.cs

Log:
 Allow any simple type for validation groupings.

File Changes:

Directory: 
/Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/Attributes/
==================================================================================================

File [modified]: GroupAttribute.cs
Delta lines: +1 -1
===================================================================

--- 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/DictionaryAdapterBase.Validate.cs
        2009-11-19 21:31:07 UTC (rev 6342)
+++ 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/DictionaryAdapterBase.Validate.cs
        2009-11-20 16:49:07 UTC (rev 6343)
@@ -67,7 +67,7 @@
                        }
                }
 
-               public IDictionaryValidate ValidateGroups(params string[] 
groups)
+               public IDictionaryValidate ValidateGroups(params object[] 
groups)
                {
                        return new DictionaryValidateGroup(groups, this);

Directory: 
/Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/
=======================================================================================

File [modified]: AssemblyInfo.cs
Delta lines: +11 -2
===================================================================

--- 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/Attributes/GroupAttribute.cs
     2009-11-19 21:31:07 UTC (rev 6342)
+++ 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/Attributes/GroupAttribute.cs
     2009-11-20 16:49:07 UTC (rev 6343)
@@ -26,14 +26,23 @@
                /// Constructs a group assignment.
                /// </summary>
                /// <param name="group">The group name.</param>
-               public GroupAttribute(String group)
+               public GroupAttribute(object group)
                {
+                       Group = new [] { group };
+               }
+
+               /// <summary>
+               /// Constructs a group assignment.
+               /// </summary>
+               /// <param name="group">The group name.</param>
+               public GroupAttribute(params object[] group)
+               {
                        Group = group;
                }
 
                /// <summary>
                /// Gets the group the property is assigned to.
                /// </summary>
-               public String Group { get; private set; }
+               public object[] Group { get; private set; }
        }

File [modified]: DictionaryAdapterBase.Validate.cs
Delta lines: +4 -4
===================================================================

--- 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/DictionaryValidateGroup.cs
       2009-11-19 21:31:07 UTC (rev 6342)
+++ 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/DictionaryValidateGroup.cs
       2009-11-20 16:49:07 UTC (rev 6343)
@@ -21,18 +21,18 @@
 
        public class DictionaryValidateGroup : IDictionaryValidate, 
INotifyPropertyChanged
        {
-               private readonly string[] _groups;
+               private readonly object[] _groups;
         private readonly IDictionaryAdapter _adapter;
                private readonly string[] _propertyNames;
 
-               public DictionaryValidateGroup(string[] groups, 
IDictionaryAdapter adapter)
+               public DictionaryValidateGroup(object[] groups, 
IDictionaryAdapter adapter)
                {
                        _groups = groups;
                        _adapter = adapter;
 
                        _propertyNames = (from property in 
_adapter.Meta.Properties.Values
                                          from groupings in 
property.Behaviors.OfType<GroupAttribute>()
-                                         where Array.IndexOf(_groups, 
groupings.Group) >= 0
+                                         where 
_groups.Intersect(groupings.Group).Any() 
                                          select 
property.PropertyName).Distinct().ToArray();
 
                        if (_propertyNames.Length > 0 && adapter.CanNotify)
@@ -82,7 +82,7 @@
                        }
                }
 
-               public IDictionaryValidate ValidateGroups(params string[] 
groups)
+               public IDictionaryValidate ValidateGroups(params object[] 
groups)
                {
                        groups = _groups.Union(groups).ToArray();

File [modified]: DictionaryValidateGroup.cs
Delta lines: +1 -1
===================================================================

--- 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/IDictionaryValidate.cs
   2009-11-19 21:31:07 UTC (rev 6342)
+++ 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter/IDictionaryValidate.cs
   2009-11-20 16:49:07 UTC (rev 6343)
@@ -26,7 +26,7 @@
 
                bool IsValid { get; }
 
-               IDictionaryValidate ValidateGroups(params string[] groups);
+               IDictionaryValidate ValidateGroups(params object[] groups);
 
                IEnumerable<IDictionaryValidator> Validators { get; }

File [modified]: IDictionaryValidate.cs
Delta lines: +1 -1
===================================================================

--- 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter.Tests/AssemblyInfo.cs
    2009-11-19 21:31:07 UTC (rev 6342)
+++ 
Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter.Tests/AssemblyInfo.cs
    2009-11-20 16:49:07 UTC (rev 6343)
@@ -6,7 +6,7 @@
 
//------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.3053
+//     Runtime Version:2.0.50727.4927
 //
 //     Changes to this file may cause incorrect behavior and will be lost if

Directory: 
/Components/DictionaryAdapter/trunk/src/Castle.Components.DictionaryAdapter.Tests/
=============================================================================================

File [modified]: AssemblyInfo.cs
Delta lines: +0 -0
===================================================================

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Commits" 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-commits?hl=.


Reply via email to