mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
quality Series.QualityProfile is lazyloaded.
This commit is contained in:
parent
d6d524e624
commit
016e360d1a
16 changed files with 154 additions and 72 deletions
|
@ -8,24 +8,29 @@ namespace NzbDrone.Core.Datastore
|
|||
{
|
||||
public static class RelationshipExtensions
|
||||
{
|
||||
public static RelationshipBuilder<TParent> HasOne<TParent, TChild>(this ColumnMapBuilder<TParent> columnMapBuilder, Expression<Func<TParent, LazyLoaded<TChild>>> portalExpression, Func<TParent, int> childIdSelector)
|
||||
public static RelationshipBuilder<TParent> HasOne<TParent, TChild>(this RelationshipBuilder<TParent> relationshipBuilder, Expression<Func<TParent, LazyLoaded<TChild>>> portalExpression, Func<TParent, int> childIdSelector)
|
||||
where TParent : ModelBase
|
||||
where TChild : ModelBase
|
||||
{
|
||||
return columnMapBuilder.Relationships.AutoMapComplexTypeProperties<ILazyLoaded>()
|
||||
.For(portalExpression.GetMemberName())
|
||||
.LazyLoad((db, parent) => db.Query<TChild>().Single(c => c.Id == childIdSelector(parent)));
|
||||
|
||||
return relationshipBuilder.For(portalExpression.GetMemberName())
|
||||
.LazyLoad((db, parent) => db.Query<TChild>()
|
||||
.Single(c => c.Id == childIdSelector(parent)));
|
||||
|
||||
}
|
||||
|
||||
public static RelationshipBuilder<TParent> HasMany<TParent, TChild>(this ColumnMapBuilder<TParent> columnMapBuilder, Expression<Func<TParent, LazyList<TChild>>> portalExpression, Func<TParent, int> childIdSelector)
|
||||
public static RelationshipBuilder<TParent> Relationship<TParent>(this ColumnMapBuilder<TParent> mapBuilder)
|
||||
{
|
||||
return mapBuilder.Relationships.AutoMapComplexTypeProperties<ILazyLoaded>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static RelationshipBuilder<TParent> HasMany<TParent, TChild>(this RelationshipBuilder<TParent> relationshipBuilder, Expression<Func<TParent, LazyList<TChild>>> portalExpression, Func<TParent, int> childIdSelector)
|
||||
where TParent : ModelBase
|
||||
where TChild : ModelBase
|
||||
{
|
||||
return columnMapBuilder.Relationships.AutoMapComplexTypeProperties<ILazyLoaded>()
|
||||
.For(portalExpression.GetMemberName())
|
||||
.LazyLoad((db, parent) => db.Query<TChild>().Where(c => c.Id == childIdSelector(parent)).ToList());
|
||||
return relationshipBuilder.For(portalExpression.GetMemberName())
|
||||
.LazyLoad((db, parent) => db.Query<TChild>().Where(c => c.Id == childIdSelector(parent)).ToList());
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue