Итак, у меня есть объект VideoAsset, который сопоставлен с VideoCategory и Group. Оба много ко многим:
public class VideoAssetMap : IAutoMappingOverride<VideoAsset>
{
public void Override(AutoMapping<VideoAsset> mapping)
{
mapping.Map(x => x.Description)
.CustomSqlType("NTEXT");
mapping.HasManyToMany<Group>(x => x.Groups)
.Table("VideoAssetGroups")
.ParentKeyColumn("VideoAssetId")
.ChildKeyColumn("GroupId")
.AsSet();
mapping.HasManyToMany<VideoCategory>(x => x.Categories)
.Table("VideoCategoryRel")
.ParentKeyColumn("VideoCategoryId")
.ChildKeyColumn("VideoAssetId")
.AsSet();
}
}
Когда я пытаюсь выполнить следующий запрос в nunit с sqlite, используя следующее:
ICriteria query = this.Session.CreateCriteria<VideoAsset>("a")
.CreateAlias("a.Categories", "c")
.CreateAlias("a.Groups", " ag")
.Add(Restrictions.Eq("c.Id", category.Id))
.Add(Restrictions.Eq("a.Enabled", true));
Мой sql не может быть выполнен, потому что он не работает:
inner join Groups alias_ ag2_ on groups4_.GroupId=alias_ ag2_.GroupId
Я проверил свои таблицы базы данных и не думаю, что с ними что-то не так. Есть идеи?