Skip to content

Commit e9bcc58

Browse files
committed
Fixed binary compatibility issues with 1.1
1 parent 10e4aec commit e9bcc58

File tree

7 files changed

+71
-62
lines changed

7 files changed

+71
-62
lines changed

src/FluentNHibernate/Cfg/MappingConfiguration.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ public class MappingConfiguration
1212
private bool mergeMappings;
1313
IDiagnosticLogger logger;
1414

15+
public MappingConfiguration()
16+
: this(new NullDiagnosticsLogger())
17+
{}
18+
1519
public MappingConfiguration(IDiagnosticLogger logger)
1620
{
1721
this.logger = logger;

src/FluentNHibernate/CombinedAssemblyTypeSource.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Reflection;
45
using FluentNHibernate.Diagnostics;
56

67
namespace FluentNHibernate
@@ -12,6 +13,10 @@ public class CombinedAssemblyTypeSource : ITypeSource
1213
{
1314
readonly AssemblyTypeSource[] sources;
1415

16+
public CombinedAssemblyTypeSource(IEnumerable<Assembly> sources)
17+
: this(sources.Select(x => new AssemblyTypeSource(x)))
18+
{}
19+
1520
public CombinedAssemblyTypeSource(IEnumerable<AssemblyTypeSource> sources)
1621
{
1722
this.sources = sources.ToArray();

src/FluentNHibernate/MappingModel/Output/Sorting/BaseXmlNodeSorter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ namespace FluentNHibernate.MappingModel.Output.Sorting
66
{
77
public abstract class BaseXmlNodeSorter
88
{
9-
protected const int Top = 0;
10-
protected const int Middle = 1;
11-
protected const int Bottom = 2;
9+
protected const int First = 0; // Top
10+
protected const int Anywhere = 1; // Middle
11+
protected const int Last = 2; // Bottom
1212

1313
public XmlNode Sort(XmlNode node)
1414
{
@@ -33,9 +33,9 @@ public XmlNode Sort(XmlNode node)
3333
var ySort = sorting[y.Name];
3434

3535
//General Position
36-
if (xSort.DocumentSection != ySort.DocumentSection) return xSort.DocumentSection.CompareTo(ySort.DocumentSection);
36+
if (xSort.Position != ySort.Position) return xSort.Position.CompareTo(ySort.Position);
3737
//Sub-Position if positions are the same
38-
if (xSort.RankWithinSection != ySort.RankWithinSection) return xSort.RankWithinSection.CompareTo(ySort.RankWithinSection);
38+
if (xSort.Level != ySort.Level) return xSort.Level.CompareTo(ySort.Level);
3939

4040
//Relative Index based on the order the part was added
4141
return Array.IndexOf(originalSortOrder, x).CompareTo(Array.IndexOf(originalSortOrder, y));

src/FluentNHibernate/MappingModel/Output/Sorting/SortValue.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace FluentNHibernate.MappingModel.Output.Sorting
22
{
33
public class SortValue
44
{
5-
public int DocumentSection { get; set; }
6-
public int RankWithinSection { get; set; }
5+
public int Position { get; set; } // Document section
6+
public int Level { get; set; } // Rank within section
77
}
88
}

src/FluentNHibernate/MappingModel/Output/Sorting/XmlClasslikeNodeSorter.cs

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,49 @@ protected override IDictionary<string, SortValue> GetSorting()
1111
return new Dictionary<string, SortValue>
1212
{
1313
// top section
14-
{ "meta", new SortValue { DocumentSection = Top, RankWithinSection = 1 } },
15-
{ "subselect", new SortValue { DocumentSection = Top, RankWithinSection = 2 } },
16-
{ "cache", new SortValue { DocumentSection = Top, RankWithinSection = 3 } },
17-
{ "synchronize", new SortValue { DocumentSection = Top, RankWithinSection = 4 } },
18-
{ "comment", new SortValue { DocumentSection = Top, RankWithinSection = 5 } },
19-
{ "tuplizer", new SortValue { DocumentSection = Top, RankWithinSection = 6 } },
20-
{ "key", new SortValue { DocumentSection = Top, RankWithinSection = 7 } },
21-
{ "parent", new SortValue { DocumentSection = Top, RankWithinSection = 7 } },
22-
{ "id", new SortValue { DocumentSection = Top, RankWithinSection = 7 } },
23-
{ "composite-id", new SortValue { DocumentSection = Top, RankWithinSection = 7 } },
24-
{ "discriminator", new SortValue { DocumentSection = Top, RankWithinSection = 8 } },
25-
{ "natural-id", new SortValue { DocumentSection = Top, RankWithinSection = 9 } },
26-
{ "version", new SortValue { DocumentSection = Top, RankWithinSection = 10 } },
27-
{ "timestamp", new SortValue { DocumentSection = Top, RankWithinSection = 10 } },
14+
{ "meta", new SortValue { Position = First, Level = 1 } },
15+
{ "subselect", new SortValue { Position = First, Level = 2 } },
16+
{ "cache", new SortValue { Position = First, Level = 3 } },
17+
{ "synchronize", new SortValue { Position = First, Level = 4 } },
18+
{ "comment", new SortValue { Position = First, Level = 5 } },
19+
{ "tuplizer", new SortValue { Position = First, Level = 6 } },
20+
{ "key", new SortValue { Position = First, Level = 7 } },
21+
{ "parent", new SortValue { Position = First, Level = 7 } },
22+
{ "id", new SortValue { Position = First, Level = 7 } },
23+
{ "composite-id", new SortValue { Position = First, Level = 7 } },
24+
{ "discriminator", new SortValue { Position = First, Level = 8 } },
25+
{ "natural-id", new SortValue { Position = First, Level = 9 } },
26+
{ "version", new SortValue { Position = First, Level = 10 } },
27+
{ "timestamp", new SortValue { Position = First, Level = 10 } },
2828

2929
// middle section
30-
{ "property", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
31-
{ "many-to-one", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
32-
{ "one-to-one", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
33-
{ "component", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
34-
{ "dynamic-component", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
35-
{ "properties", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
36-
{ "any", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
37-
{ "map", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
38-
{ "set", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
39-
{ "list", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
40-
{ "bag", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
41-
{ "idbag", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
42-
{ "array", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
43-
{ "primitive-array", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
30+
{ "property", new SortValue { Position = Anywhere, Level = 1 } },
31+
{ "many-to-one", new SortValue { Position = Anywhere, Level = 1 } },
32+
{ "one-to-one", new SortValue { Position = Anywhere, Level = 1 } },
33+
{ "component", new SortValue { Position = Anywhere, Level = 1 } },
34+
{ "dynamic-component", new SortValue { Position = Anywhere, Level = 1 } },
35+
{ "properties", new SortValue { Position = Anywhere, Level = 1 } },
36+
{ "any", new SortValue { Position = Anywhere, Level = 1 } },
37+
{ "map", new SortValue { Position = Anywhere, Level = 1 } },
38+
{ "set", new SortValue { Position = Anywhere, Level = 1 } },
39+
{ "list", new SortValue { Position = Anywhere, Level = 1 } },
40+
{ "bag", new SortValue { Position = Anywhere, Level = 1 } },
41+
{ "idbag", new SortValue { Position = Anywhere, Level = 1 } },
42+
{ "array", new SortValue { Position = Anywhere, Level = 1 } },
43+
{ "primitive-array", new SortValue { Position = Anywhere, Level = 1 } },
4444

4545
// bottom section
46-
{ "join", new SortValue { DocumentSection = Bottom, RankWithinSection = 1 } },
47-
{ "subclass", new SortValue { DocumentSection = Bottom, RankWithinSection = 2 } },
48-
{ "joined-subclass", new SortValue { DocumentSection = Bottom, RankWithinSection = 3 } },
49-
{ "union-subclass", new SortValue { DocumentSection = Bottom, RankWithinSection = 4 } },
50-
{ "loader", new SortValue { DocumentSection = Bottom, RankWithinSection = 5 } },
51-
{ "sql-insert", new SortValue { DocumentSection = Bottom, RankWithinSection = 6 } },
52-
{ "sql-update", new SortValue { DocumentSection = Bottom, RankWithinSection = 7 } },
53-
{ "sql-delete", new SortValue { DocumentSection = Bottom, RankWithinSection = 8 } },
54-
{ "filter", new SortValue { DocumentSection = Bottom, RankWithinSection = 9 } },
55-
{ "query", new SortValue { DocumentSection = Bottom, RankWithinSection = 10 } },
56-
{ "sql-query", new SortValue { DocumentSection = Bottom, RankWithinSection = 11 } },
46+
{ "join", new SortValue { Position = Last, Level = 1 } },
47+
{ "subclass", new SortValue { Position = Last, Level = 2 } },
48+
{ "joined-subclass", new SortValue { Position = Last, Level = 3 } },
49+
{ "union-subclass", new SortValue { Position = Last, Level = 4 } },
50+
{ "loader", new SortValue { Position = Last, Level = 5 } },
51+
{ "sql-insert", new SortValue { Position = Last, Level = 6 } },
52+
{ "sql-update", new SortValue { Position = Last, Level = 7 } },
53+
{ "sql-delete", new SortValue { Position = Last, Level = 8 } },
54+
{ "filter", new SortValue { Position = Last, Level = 9 } },
55+
{ "query", new SortValue { Position = Last, Level = 10 } },
56+
{ "sql-query", new SortValue { Position = Last, Level = 11 } },
5757
};
5858
}
5959

src/FluentNHibernate/MappingModel/Output/Sorting/XmlCollectionNodeSorter.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ protected override IDictionary<string, SortValue> GetSorting()
99
{
1010
return new Dictionary<string, SortValue>
1111
{
12-
{ "meta", new SortValue { DocumentSection = Top, RankWithinSection = 1 } },
13-
{ "jcs-cache", new SortValue { DocumentSection = Top, RankWithinSection = 1 } },
14-
{ "cache", new SortValue { DocumentSection = Top, RankWithinSection = 1 } },
15-
{ "key", new SortValue { DocumentSection = Top, RankWithinSection = 3 } },
16-
{ "index", new SortValue { DocumentSection = Top, RankWithinSection = 4 } },
17-
{ "list-index", new SortValue { DocumentSection = Top, RankWithinSection = 4 } },
18-
{ "index-many-to-many", new SortValue { DocumentSection = Top, RankWithinSection = 4} },
19-
{ "element", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
20-
{ "one-to-many", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
21-
{ "many-to-many", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
22-
{ "composite-element", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
23-
{ "many-to-any", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
24-
{ "filter", new SortValue { DocumentSection = Bottom, RankWithinSection = 1 } },
12+
{ "meta", new SortValue { Position = First, Level = 1 } },
13+
{ "jcs-cache", new SortValue { Position = First, Level = 1 } },
14+
{ "cache", new SortValue { Position = First, Level = 1 } },
15+
{ "key", new SortValue { Position = First, Level = 3 } },
16+
{ "index", new SortValue { Position = First, Level = 4 } },
17+
{ "list-index", new SortValue { Position = First, Level = 4 } },
18+
{ "index-many-to-many", new SortValue { Position = First, Level = 4} },
19+
{ "element", new SortValue { Position = Anywhere, Level = 1 } },
20+
{ "one-to-many", new SortValue { Position = Anywhere, Level = 1 } },
21+
{ "many-to-many", new SortValue { Position = Anywhere, Level = 1 } },
22+
{ "composite-element", new SortValue { Position = Anywhere, Level = 1 } },
23+
{ "many-to-any", new SortValue { Position = Anywhere, Level = 1 } },
24+
{ "filter", new SortValue { Position = Last, Level = 1 } },
2525
};
2626
}
2727

src/FluentNHibernate/MappingModel/Output/Sorting/XmlIdNodeSorter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ protected override IDictionary<string, SortValue> GetSorting()
99
{
1010
return new Dictionary<string, SortValue>
1111
{
12-
{ "meta", new SortValue { DocumentSection = Top, RankWithinSection = 1 } },
13-
{ "column", new SortValue { DocumentSection = Middle, RankWithinSection = 1 } },
14-
{ "generator", new SortValue { DocumentSection = Bottom, RankWithinSection = 1 } },
12+
{ "meta", new SortValue { Position = First, Level = 1 } },
13+
{ "column", new SortValue { Position = Anywhere, Level = 1 } },
14+
{ "generator", new SortValue { Position = Last, Level = 1 } },
1515
};
1616
}
1717

0 commit comments

Comments
 (0)