> > Thank you very much for your patient and your answer. > I do not know If i have understud properly the concept of this: " Both sides of the now one to many need to be saved or updated first. "
For instance, I have created a 2 new tables to do the tests. Teachers and Classes. They have only the attitubutes Id and Name. And I have added a relation one to many from teacher to classes. public class Classes : I_DTO { public virtual int Id { get; set; } public virtual string Name { get; set; } public Classes() { } } namespace ExCon_DAO_SQL.DTO.Wall { public class Teacher : I_DTO { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual IList<Classes> Classes { get; set; } public Teacher() { Classes = new List<Classes>(); } } public class Teacher_Map : IAutoMappingOverride<Teacher> { public void Override(AutoMapping<Teacher> mapping) { mapping.HasMany(x => x.Classes).LazyLoad(). Inverse().AsBag().ForeignKeyConstraintName("Teacher_Id").Cascade.AllDeleteOrphan(); } } Ok, I have Save a Teacher with a clases in the list of clases. Both elements are saved in the database but the clases has in the database the element Teacher_Id as null is this behaivor normal? second test: public class Classes : I_DTO { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual Teacher teacher { get; set; } public Classes() { teacher = new Teacher(); } } public class Classes_Map : IAutoMappingOverride<Classes> { public void Override(AutoMapping<Classes> mapping) { mapping.References(x => x.teacher).Column("Teacher_Id"); } } Now I have been able to get the target but in this way: Teacher profe = new Teacher(); profe.Name = "Peter"; List<Classes> classes = new List<Classes>(); Classes clase1 = new Classes(); clase1.Name = "Class1"; clase1.teacher = profe; classes.Add(clase1); profe.Classes = classes; DAO_Result resultado = SQL_DAO_Service.Add<Teacher>(profe); I have to add to the teacher the clasess, and each class have to has as well the reference of the teacher to se that in the save it is able to generate all properly is this behaviour correct? And last but not least If I have do and update of this teacher and and 2 clases with him, and after that I remove one of the element of the classes list, and I update the teacher, the system is not able to know that What I want is to delete the class from the database, so i will have to check on my own if the list of clases does not have and ald element to delete it... is this correct? thanks a lot!!! best regards... -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibernate+unsubscr...@googlegroups.com. To post to this group, send email to fluent-nhibernate@googlegroups.com. Visit this group at https://groups.google.com/group/fluent-nhibernate. For more options, visit https://groups.google.com/d/optout.