I have a table that contains some blob fields that I don't want to load by default.
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?
I have a table that contains some blob fields that I don't want to load by default.
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?
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; }
}
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.
I believe you would have to do something like what Daniel Schaffer said in code, but without the [Column] attribute, since you would define the mapping in the XML file.