Permalink
Browse files

* FilterDefinitions are now also copied in Automapping.AlterModel

  • Loading branch information...
1 parent d2f3887 commit 29058de9b2bc3af85bc433aa6f71549f7b5d8e04 Tom Janssens committed Apr 19, 2010
@@ -75,6 +75,9 @@ void IAutoClasslike.AlterModel(ClassMappingBase mapping)
foreach (var storedProcedure in storedProcedures)
mapping.AddStoredProcedure(storedProcedure.GetStoredProcedureMapping());
+
+ foreach (var filter in filters)
+ mapping.AddOrReplaceFilter(filter.GetFilterMapping());
}
protected override OneToManyPart<TChild> HasMany<TChild>(Member property)
@@ -149,6 +149,11 @@ public void AddFilter(FilterMapping mapping)
mappedMembers.AddFilter(mapping);
}
+ public void AddOrReplaceFilter(FilterMapping mapping)
+ {
+ mappedMembers.AddOrReplaceFilter(mapping);
+ }
+
public void AddSubclass(SubclassMapping subclass)
{
subclasses.Add(subclass);
@@ -190,5 +195,6 @@ public override int GetHashCode()
return ((mappedMembers != null ? mappedMembers.GetHashCode() : 0) * 397) ^ (subclasses != null ? subclasses.GetHashCode() : 0);
}
}
+
}
}
@@ -71,6 +71,15 @@ public IEnumerable<FilterMapping> Filters
get { return filters; }
}
+ public void AddOrReplaceFilter(FilterMapping mapping)
+ {
+ var filter = filters.Find(x => x.Name == mapping.Name);
+ if (filter != null)
+ filters.Remove(filter);
+ filters.Add(mapping);
+ }
+
+
public IEnumerable<StoredProcedureMapping> StoredProcedures
{
get { return storedProcedures; }
@@ -255,5 +264,6 @@ public override int GetHashCode()
return result;
}
}
+
}
}

4 comments on commit 29058de

@ragamuf

What is the status of this patch? Thanks.

@ToJans
Owner
ToJans commented on 29058de Feb 15, 2011

It should have been merged a few releases ago

@ragamuf

I see the changes in the master branch but the filter is still broken.

{"filter-def for filter named myFilterName was not found."}

@ragamuf

Correction, it is broken in the stable release branch.

fluentnhibernate-NH3.0-binary-1.2.0.694

Please sign in to comment.