views:

121

answers:

0

This is my mapping

public class SubMatterMapping : ClassMapping { public SubMatterMapping() {

        LazyLoad();

        Map(x => x.Description);
        Map(x => x.SubMatterCount);
        References(x => x.SubMatterStatus).WithForeignKey().TheColumnNameIs("StatusID").FetchType.Select();
        HasManyToMany(x => x.Searches).WithTableName("tblSearchSubMatter")
            .WithParentKeyColumn("SubMatterID")
            .WithChildKeyColumn("SearchID").AsBag().Cascade.None();

        HasMany(x => x.SubMatterDefinitions).WithKeyColumn("SubMatterID").Inverse().AsBag().FetchType.Select();

    }
}

public class SearchMapping : BaseMapping { public SearchMapping() { Not.LazyLoad();

        //LazyLoad();

        Map(x => x.Name);
        Map(x => x.DateSaved);


        HasManyToMany(x => x.SubMatters).AsBag()
            .WithTableName("tblSearchSubMatter")
            .WithParentKeyColumn("SearchID")
            .WithChildKeyColumn("SubMatterID").Cascade.None().Inverse();


        References(x => x.SearchStatus).WithForeignKey().TheColumnNameIs("StatusID").Cascade.None();
    }
}

When the Search is saved, the tblSearchSubMatter needs to get updated with the SearchId and SubMatterId which is not happening ..

The Search table is getting updated though..

I went through a few posts and tried but have been unsuccessful. any directions to this newbie would be very helpful

related questions