0
我想这些实体映射:EF5流利的API映射
[Table("AAN_DigitalLib_Asset")]
public class Asset
{
[Column("ID")]
public int ID { get; set; }
[Column("format_id")]
public int FormatID { get; set; }
[Column("person_id")]
public int? PersonID { get; set; }
[Column("publicationYear")]
public int? PublicationYear { get; set; }
public Person People { get; set; }
//public virtual AssetKeyword AssetKeywords { get; set; }
public virtual ICollection<AssetKeyword> AssetKeywords { get; set; }
}
与这些实体:
[Table("AAN_DigitalLib_AssetKeyword")]
public class AssetKeyword
{
[Column("ID")]
public int ID { get; set; }
[Column("asset_id")]
public int AssetID { get; set; }
[Column("keyword")]
public string Keyword { get; set; }
}
如果单Asset
可以有很多AssetKeywords
。数据库中没有指定任何关系,那么如何使用Fluent API创建一个关系?
谢谢你,我想你的第一个例子做的伎俩。 – user547794