I have a table (UncommittedVideoFile
) that has a strict one-to-one relationship with a different table (VideoOrImageAsset
). When I load an UncommittedVideoFile, I want to load the VideoOrImageAsset in the same query via a JOIN. (Inner or left outer).
Apparently it's possible to specify fetch-by-join when you use xml mapping: https://ayende.com/blog/3960/nhibernate-mapping-one-to-one
It's also possible if you are using Fluent NHibernate: https://stackoverflow.com/a/15694723/25216
But using MappingByCode, is is possible to set a Fetch option? I can't see one anywhere.
Here is the code that I currently have. The IOneToOneMapper
interface does not have a Fetch
method.
classMapper.OneToOne(
f => f.VideoOrImageAsset,
oneToOneMapper =>
{
oneToOneMapper.Constrained(true);
oneToOneMapper.ForeignKey("Id");
oneToOneMapper.Lazy(LazyRelation.NoLazy);
}
);