Skip to content

Instantly share code, notes, and snippets.

@g0t4
Created September 26, 2012 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g0t4/3790082 to your computer and use it in GitHub Desktop.
Save g0t4/3790082 to your computer and use it in GitHub Desktop.
Mapping a collection of Guids in FluentNHibernate
public class Approved
{
public virtual Guid Id { get; set; }
public virtual IEnumerable<Guid> EntryIds { get; set; }
}
// Mapping, Table specifies the table name to use, element specifies the column the Guid is stored in, KeyColumn specifies the foreign key in the table to link back to the parent Approved item
HasMany(x => x.EntryIds)
.Table("ApprovedEntryIds")
.Element("EntryId")
.KeyColumn("ApprovedId")
.Cascade
.AllDeleteOrphan()
.Not.LazyLoad()
.BatchSize(1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment