如何延迟加载aproperty与LINQ to SQL的外部映射?加载、aproperty、LINQ、to

由网友(醉卧美人膝)分享简介:我有一个包含我不希望在默认情况下加载一些BLOB字段的表。 I have a table that contains some blob fields that I don't want to load by default. 在一个文件中的dbml可以设置延迟加载属性等领域。 In a dbml file it...

我有一个包含我不希望在默认情况下加载一些BLOB字段的表。

I have a table that contains some blob fields that I don't want to load by default.

在一个文件中的dbml可以设置延迟加载属性等领域。

In a dbml file it is possible to set the delay loaded property for such fields.

是否有外部映射文件的类似选项?

Is there a similar option for external mapping files?

推荐答案

我不熟悉外部映射文件,但是这基本上是你怎么做延迟加载使用LINQ到SQL:

I'm not familiar with "external mapping files", but this is basically how you do lazy loading with LINQ-to-SQL:

    private System.Data.Linq.Link<String> _content;
    [Column(Name = "content", DbType = "NVarChar(MAX) NOT NULL", Storage = "_content")]
    public String Content
    {
        get { return this._content.Value; }
        set { this._content.Value = value; }
    }

使用 System.Data.Linq.Link&LT;字符串&GT; 作为私有变量将导致要被延迟加载的财产,除非延迟加载处于关闭状态,在DataContext

Using System.Data.Linq.Link<String> as the private variable causes that property to be delay loaded, unless delay loading is disabled on the DataContext.

阅读全文

相关推荐

最新文章