foriegn key is not set in saveOrUpdate

30 views
Skip to first unread message

ho ihu

unread,
Mar 12, 2022, 3:21:42 PM3/12/22
to nhusers
Deat friends
Fluent Nhibernate is not setting the value of foriegn key in children table, is there anyone to write the reason ?

My code:
    public class StoreMapping : ClassMap<StoreModel>
    {
        public AcademicBooksMapping()
        {
            Table("Store");
            Id(u => u.Id);
            Map(u => u.name).Nullable();
HasMany(x => x.Books).Not.KeyNullable().KeyColumn("StoreId").Inverse().Cascade.All().Not.LazyLoad();
            }
        }
    public class BooksMapping : ClassMap<BookModel>
    {
        public BooksMapping()
        {
            Table("Book");
            Id(u => u.Id);
            Map(u => u.name).Nullable();
           References(x => x.Profile).Column("StoreId").Cascade.SaveUpdate().Not.LazyLoad();
            }
        }
StoreId is null en every save
Reply all
Reply to author
Forward
0 new messages