Suppose we have the following class:
<code>public class Test{
public int Id{ get; set;}
private readonly List<string> _helpers = new();
public IEnumerable<string> Helpers => _helpers;
}
</code>
<code>public class Test{
public int Id{ get; set;}
private readonly List<string> _helpers = new();
public IEnumerable<string> Helpers => _helpers;
}
</code>
public class Test{
public int Id{ get; set;}
private readonly List<string> _helpers = new();
public IEnumerable<string> Helpers => _helpers;
}
With NHibernate, I can map the Helpers
property into an external table like this:
<code> // using fluent NH class
HasMany(gt => gt.Helpers)
.Access.CamelCaseField(Prefix.Underscore)
.AsBag()
.Table("OtherTabble") // table that keeps the Helper's list
.KeyColumn("ForeignKey") // foreign key point back to Test
.Element("DB_Column_name") //name of the column that holds each helper
.Not.LazyLoad()
.Cascade.All();
</code>
<code> // using fluent NH class
HasMany(gt => gt.Helpers)
.Access.CamelCaseField(Prefix.Underscore)
.AsBag()
.Table("OtherTabble") // table that keeps the Helper's list
.KeyColumn("ForeignKey") // foreign key point back to Test
.Element("DB_Column_name") //name of the column that holds each helper
.Not.LazyLoad()
.Cascade.All();
</code>
// using fluent NH class
HasMany(gt => gt.Helpers)
.Access.CamelCaseField(Prefix.Underscore)
.AsBag()
.Table("OtherTabble") // table that keeps the Helper's list
.KeyColumn("ForeignKey") // foreign key point back to Test
.Element("DB_Column_name") //name of the column that holds each helper
.Not.LazyLoad()
.Cascade.All();
I know that EF core supports Owned entities collections, but how can I map the string collection exposed from Helpers
into another table’s column without creating a new class for holding the string?