Created
March 5, 2010 19:26
-
-
Save chadmyers/323037 to your computer and use it in GitHub Desktop.
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
public class Queue : DomainEntity | |
{ | |
private readonly IList<User> _members = new List<User>(); | |
private readonly IList<User> _supervisors = new List<User>(); | |
public IEnumerable<User> GetMembers() | |
{ | |
return _members.AsEnumerable(); | |
} | |
public IEnumerable<User> GetSupervisors() | |
{ | |
return _supervisors.AsEnumerable(); | |
} | |
} |
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
public class QueueMap : DomainMap<Queue> | |
{ | |
public QueueMap() | |
{ | |
HasManyToMany<User>(x => x.GetSupervisors()) | |
.WithTableName("QueueToSupervisorUser") | |
.Access.AsCamelCaseField(Prefix.Underscore) | |
.LazyLoad() | |
.Inverse() | |
.Cascade.All(); | |
HasManyToMany<User>(x => x.GetMembers()) | |
.WithTableName("QueueToUser") | |
.Access.AsCamelCaseField(Prefix.Underscore) | |
.LazyLoad() | |
.Inverse() | |
.Cascade.All(); | |
} | |
} |
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
public class User : DomainEntity | |
{ | |
private readonly IList<Queue> _membershipQueues = new List<Queue>(); | |
private readonly IList<Queue> _supervisedQueues = new List<Queue>(); | |
public IEnumerable<Queue> GetMembershipQueues() { return _membershipQueues; } | |
public IEnumerable<Queue> GetSupervisedQueues(){ return _supervisedQueues; } | |
} |
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
public class UserMap : DomainMap<User> | |
{ | |
public UserMap() | |
{ | |
WithTable("Users"); | |
HasManyToMany<Queue>(x => x.GetSupervisedQueues()) | |
.WithTableName("QueueToSupervisorUser") | |
.LazyLoad() | |
.Access.AsCamelCaseField(Prefix.Underscore) | |
.Cascade.All(); | |
HasManyToMany<Queue>(x => x.GetMembershipQueues()) | |
.WithTableName("QueueToUser") | |
.LazyLoad() | |
.Access.AsCamelCaseField(Prefix.Underscore) | |
.Cascade.All(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment