Castle.MonoRail.ActiveRecordSupport.ARDataBinder.FindPropertyInHasMany C# (CSharp) Method

FindPropertyInHasMany() protected method

for joined subclasses HasMany properties doesn't include the ones of the parent class so we need to check them recursively
protected FindPropertyInHasMany ( ActiveRecordModel model, string propertyName, Type &foundType, ActiveRecordModel &foundModel ) : bool
model Castle.ActiveRecord.Framework.Internal.ActiveRecordModel
propertyName string
foundType System.Type
foundModel Castle.ActiveRecord.Framework.Internal.ActiveRecordModel
return bool
		protected bool FindPropertyInHasMany(ActiveRecordModel model, string propertyName,
											 ref Type foundType, ref ActiveRecordModel foundModel)
		{
			foreach(HasManyModel hasManyModel in model.HasMany)
			{
				// Inverse=true relations will be ignored
				if (hasManyModel.Property.Name == propertyName && !hasManyModel.HasManyAtt.Inverse)
				{
					foundType = hasManyModel.HasManyAtt.MapType;
					foundModel = ActiveRecordModel.GetModel(foundType);
					return true;
				}
			}
			if (model.IsJoinedSubClass || model.IsDiscriminatorSubClass)
			{
				return FindPropertyInHasMany(model.Parent, propertyName, ref foundType, ref foundModel);
			}
			return false;
		}