它的工作原理。提取數據,但給出了這樣的錯誤:到裝填回收多個hasmany相同的keycolumn - 非法訪問加載收集
public class Image : File
{
public virtual string ImagePath { get; set; }
}
public class Video : File
{
public virtual string VideoPath { get; set; }
public virtual string VideoType { get; set; }
}
public class Service : ContentBase
{
public virtual IList<Image> Images { get; set; }
public virtual IList<Video> Videos { get; set; }
}
public class ServiceMap:SubclassMap<Domain.Service>
{
public ServiceMap()
{
DiscriminatorValue("Service");
HasMany(x => x.Images).KeyColumn("ContentBase");
HasMany(x => x.Videos).KeyColumn("ContentBase");
}
}
public class ImageMap:SubclassMap<Image>
{
public ImageMap()
{
DiscriminatorValue("Image");
Map(x => x.ImagePath);
}
}
public class VideoMap:SubclassMap<Video>
{
public VideoMap()
{
DiscriminatorValue("Video");
Map(x => x.VideoPath);
}
}
它的作品的非法訪問。但是當我查詢時會出現這個錯誤。我認爲相同的「keycolumn」會給出這個錯誤。 mapping'i我應該怎麼做?
視頻和圖像的映射怎麼樣? – Firo
代碼加起來:) –
var service = UnitOfWork.CurrentSession.QueryOver() .JoinAlias(x => x.ThumbImage,()=> thumbImage) .JoinAlias(x => x.MainImage, ()=> mainImage) .Where(x => x.Id == serviceId) .SingleOrDefault(); –