We are not using Fluent Nhibernate. We have a table with a blob column which we would like to load conditionally. We already have specified it as 'lazy' and lazy loading is working fine. Is there a way to not load data for that column at all on a certain condition ? (hence for the property in respective class)
For example, here is the mapping
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Blah.blah.blah" assembly="Blah.blah">
<class name="MyDocument" table="HEAVY_DOCS">
<id name="Id" column="docnum" type="decimal"> </id>
<property name="docname" column="docname" />
<property name="details" column="details" />
<property name="doc_data" column="document_data" lazy="true" />
</class>
</hibernate-mapping>
and below is the code getting document
private IList<MyDocument> FetchDocuments(IList<string> docId, bool laodData)
{
if(!laodData)
{
docs = (from doc in Session.Query<MyDocument>()
where docId.Contains(doc.docnum)
select doc).ToList();
}
else
{
//if laodData is false dont load column document_data
}
return docs ;
}