forked from nhibernate/fluent-nhibernate
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Possible fix for nhibernate#330 - Feature: Support for additional att…
…ributes in the key-property element of an set (and equal)
- Loading branch information
Showing
3 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System.Collections.Generic; | ||
using FluentNHibernate.MappingModel; | ||
|
||
namespace FluentNHibernate.Mapping | ||
{ | ||
public class ColumnMappingCollection<TParent> | ||
{ | ||
private readonly IList<ColumnMapping> columnMappings = new List<ColumnMapping>(); | ||
private readonly TParent parent; | ||
|
||
public ColumnMappingCollection(TParent parent) | ||
{ | ||
this.parent = parent; | ||
} | ||
|
||
public TParent Add(string name) | ||
{ | ||
columnMappings.Add(new ColumnMapping{Name = name}); | ||
return parent; | ||
} | ||
|
||
public TParent Add(ColumnMapping mapping) | ||
{ | ||
columnMappings.Add(mapping); | ||
return parent; | ||
} | ||
|
||
public TParent Add(params ColumnMapping[] mappings) | ||
{ | ||
foreach (var mapping in mappings) | ||
{ | ||
Add(mapping); | ||
} | ||
return parent; | ||
} | ||
|
||
public TParent Add(params string[] names) | ||
{ | ||
foreach(var name in names) | ||
{ | ||
Add(name); | ||
} | ||
return parent; | ||
} | ||
|
||
public TParent Clear() | ||
{ | ||
columnMappings.Clear(); | ||
return parent; | ||
} | ||
|
||
public IList<ColumnMapping> List() | ||
{ | ||
return new List<ColumnMapping>(columnMappings).AsReadOnly(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters