NHibernate session.saveOrUpdate takes a long time

102 Views Asked by At

I have the below mapping of data, everything is mapped correctly for each mode

public DataMap()
    {
        Id(x => x.Id).GeneratedBy.Identity().UnsavedValue(0);
        Map(x => x.Name).Not.Nullable();
        Map(x => x.CreatedTime).Not.Nullable();
        HasMany(x => x.SourceData)
            .Not.KeyNullable()
            .KeyColumn("SourceId")
            .Cascade.AllDeleteOrphan()
            .Inverse();
        HasMany(x => x.LinkData)
            .Not.KeyNullable()
            .KeyColumn("LinkDataId")
            .Cascade.AllDeleteOrphan()
            .Inverse();
        HasMany(x => x.ImageData)
            .Not.KeyNullable()
            .KeyColumn("ImageDataId")
            .Cascade.AllDeleteOrphan()
            .Inverse();
        HasMany(x => x.Configuration)
            .Not.KeyNullable()
            .KeyColumn("ConfigurationId")
            .Cascade.AllDeleteOrphan()
            .Not.LazyLoad();
        Map(x => x.Enabled).Not.Nullable();
    }

during the save session.SaveOrUpdate(Data) it takes it a long time for everything to be saved. Note that all foreign keys are indexed, and tried to use merge instead of SaveOrUpdate. but the result are the same.

Is there anyway to improve the transaction or the mapping for a better performance ?

0

There are 0 best solutions below