简体   繁体   中英

NHibernate: Lazy Loading Properties

So, according to Ayende Lazy Loading Properties are already in the NHibernate trunk.

My Problem is: I can't use the trunk for I have FluentNHibernate and LinQ for NHibernate, so I depend on the version they are linked against (Versio 2.x). I can't and don't want to build all the assemblies myself against the newest version of NHibernate.

So, has someone got information about when NHibernate 3.0 will leave Beta-Stadium and the auxiliaries (Linq etc.) will be compiled against it?

I appreciate any estimate!

I need this feature so I can use it on Blob-Fields. I don't want to use workarounds to destroy my object model.

You can compile Fluent with the NH 3.0 binaries, and you don't need L2NH anymore; there's a new integrated provider.

Alternatively it isn't much of a model change. Make a new class, Blob, that has Id, Version and Bytes properties, make a new table to match. Add the new class as a protected property to each of your classes that currently has a blob. Use it like a backing store. Change your mapping to map the underlying property instead of the public one.

public class MyClass
{
    public MyClass()
    {
        MyBlobProperty_Blob= new Blob();
    }

    public virtual byte[] MyBlobProperty
    {
        get { return MyBlobProperty_Blob.Bytes; }
    }

    protected virtual Blob MyBlobProperty_Blob { get; private set; }
}

It is a significant schema change however. This particular solution moves all your binary data into one table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM