Hi There ,
I'm using asp.net 1.1 and Nhibernate 1.2
I have kind of parent and child classes , and the problem is the child class has a byte array(byte[]) that could be very large . In fact i use this class as a picture object to fetch sql image type.
here is part of my class :
The Parent :
Code:
public class NewsEntity : BaseEntity
{
.
.
.
public virtual string Title
{
get
{
return title;
}
set { title = value; }
}
public virtual PictureEntity Picture
{
get { return picture; }
set { picture = value; }
}
and the mapping of parent is
Code:
<id name="ID" column="Id">
<generator class="identity" />
</id>
<property name="Title">
<column name="Title" length="50" not-null="true" />
</property>
<property name="Description">
<column name="Description" length="1000" not-null="false" />
</property>
<property name="UserID">
<column name="UserID" sql-type = "int" not-null="true" />
</property>
<property name="OrganizationID">
<column name="OrganizationID" sql-type = "int" not-null="true" />
</property>
<many-to-one
name="Picture"
column="ImageID"
not-null="false"/>
and the child is
Code:
public class PictureEntity: BaseEntity
{
.
.
.
.
public virtual byte[] ThumbnailContent
{
get { return thumbnailContent; }
set { thumbnailContent = value; }
}
public virtual byte[] Content
{
get { return content; }
set { content = value; }
}
}
Here is mapping of child
Code:
<id name="ID" column="Id">
<generator class="identity" />
</id>
<property name="FileSize">
<column name="FileSize" sql-type="bigint" not-null="true" />
</property>
<property name="FileName">
<column name="FileName" length="50" not-null="true" />
</property>
<property name="FileType">
<column name="FileType" length="50" not-null="true" />
</property>
<property name="ImageWidth">
<column name="ImageWidth" sql-type="int" not-null="false" />
</property>
<property name="ImageHeight">
<column name="ImageHeight" sql-type="int" not-null="false" />
</property>
<property name="ThumbnailWidth">
<column name="ThumbnailWidth" sql-type="int" not-null="false" />
</property>
<property name="ThumbnailHeight">
<column name="ThumbnailHeight" sql-type="int" not-null="false" />
</property>
<property name="ThumbnailContent" type="BinaryBlob">
<column name="ThumbnailValue" sql-type="IMAGE" not-null="true" />
</property>
<property name="Content" type="BinaryBlob">
<column name="FileValue" sql-type="IMAGE" not-null="true" />
</property>
Now , I don't want to fetch Content and ThumbnailContent when i use a collection of newsentity[The parent class] . but when i fetch one newsentity the child (picture class) load completely
Please tell me how can i do this ?
thanks a lot in advance.
Good luck