Hi,

You are barking up the wrong tree. Database files will typically never
shrink automatically and immediately just because you SQL DELETE something.
Instead, the database engine will typically mark the used space as
"available for reuse by the database engine" so that it can eventually be
overwritten with new data. Had nothing to do with nhibernate.

This behavior is both required for transaction handling, and generally
useful as an optimization - releasing and reallocating file space to/from
the operating system would generally lead to fragmented files and
negatively affect performance.

/Oskar

Den 1 feb. 2017 3:08 em skrev "Claus Volko" <[email protected]>:

> Hi there,
>
> We have a database in which we store pictures. When we delete pictures
> from the database, the file does not become smaller. So apparently, the
> pictures are not really removed from the file.
>
>     public class MachineImageMap : ModelBaseMap<MachineImage>
>     {
>         public MachineImageMap()
>         {
>             this.Map(x => x.OrderIndex);
>             this.References(x => x.Image).Cascade.All();
>         }
>     }
>
>     public class ImageResourceMap : ModelBaseMap<ImageResource>
>     {
>         public ImageResourceMap()
>         {
>             this.Map(x => x.Description);
>             this.Map(x => x.ImageData);
>             this.Map(x => x.Name);
>             this.Map(x => x.Height);
>         }
>     }
>
> The SQL log file shows that the image is deleted from both tables,
> MachineImage and ImageResource, but apparently it is not physically removed.
>
> On the Internet I read that we should perhaps use Cascade.AllDeleteOrphan.
> However, NHibernate 3.3.1.4000 does not support that. Do we have to switch
> to a newer version of NHibernate or is there another way to fix it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to