开发者

NHibernate: Lazy Loading Properties

So, accor开发者_如何学JAVAding 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜