views:

278

answers:

1

Using LINQ to SQL, is there any way to specify "Delay Loaded = true" for some properties on entities using code?

I can do it manually in the designer but I will lose that customization if the table is updated/rebound.

I know of DataLoadOptions and LoadWith(), but that's for using eager loading instead of lazy loading, and I want to specify lazy loading where eager loading is the default.

ScottGu made some interesting promises here but afaik he never followed up on it. :-)

A: 

I found the following regaring lazy loading:

 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; }
 }

Here it is in full:

http://stackoverflow.com/questions/499183/how-to-delay-loading-aproperty-with-linq-to-sql-external-mapping/499227

Don't know if this helps

Stuart