我有实体的房子,除了图像的其他属性列表。 每个图像将作为一个单独的动作上传,使用js裁剪技术逐个上传。nhibernate映射,多对一
更新: 所以一个房子可以有很多图像。
public House
{
public Guid Id {get; set;}
....
List<Image> Images {get; set;}
}
public class Images
{
public House House {get; set;}
public string Path {get;set;}
public string Name {get;set;}
public string Description {get;set;}
}
我的数据库表如下:
House
Id
Name, ...
On this side I don't have relation to the Image table
Image table
Id
HouseId
Path
Name
Description
是这种方法好不好? 如何使用nhibernate orm映射这些对象?
感谢
在多对多的关系船上,你应该有另一张表,使你的房子和图像表之间的连接,并将包含你的房子ID和图像ID。所以这样你的房子可以有很多图像,并且图像可以有很多房子(如果我正确地理解了你的问题)。 – Freeman 2012-07-18 08:40:17
刚更新的问题。我认为我需要多种方法。抱歉。 – Grunf 2012-07-18 08:44:25