Hi,
I have the class below. FNH does not seem to generate mapping for the
association without a setter (SecondaryGroups).
If I add the private setter it does generate the mapping but I don't
know how to implement the setter in this case as a backing store of
the field is HashSet and value in the setter is IEnumerable<>.
So 2 questions:
1. Is it possible to tell FNH to generate mapping for associations
without setter?
2. If No, how should I implement the setter.
Cheers,
Dmitriy.
CONFIGURATION IS:
factory = Fluently.Configure()
.Database
(SQLiteConfiguration.Standard.InMemory().ShowSql())
.Mappings(m => {
m.AutoMappings.Add
(AutoPersistenceModel.MapEntitiesFromAssemblyOf<SecurityUser>()
.Where(t => t.Namespace.EndsWith
("Security")));
}).BuildSessionFactory();
CLASS IS:
public class SecurityUser {
public SecurityUser() {
additionalPrivileges = new HashSet<SecurityPrivilege>();
}
public virtual int Id { get; set; }
public virtual string Username { get; set; }
public virtual bool Enabled { get; set; }
protected virtual string Password { get; set; }
// wrapped in method... omitted here...
public virtual SecurityGroup MainGroup { get; protected set; }
// wrapped in method... omitted here...
private HashSet<SecurityGroup> secondaryGroups;
public virtual IEnumerable<SecurityGroup> SecondaryGroups {
get {
return secondaryGroups;
}
// Setter is required by (Fluent?)NHibernate. Otherwise Fluent
does
not generates correct mapping
private set {
throw new NotImplementedException("I don't know how to
implement
this correctly");
}
}
public virtual SecurityUser AddSecondaryGroup(SecurityGroup g)
{
if (g == null)
return this;
secondaryGroups.Add(g);
return this;
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---