Skip to content

Commit e7da70e

Browse files
author
perploug
committed
Merge branch '7.1.0' of https://github.com/umbraco/Umbraco-CMS into 7.1.0
2 parents 200cec0 + 66d61c9 commit e7da70e

File tree

5 files changed

+116
-4
lines changed

5 files changed

+116
-4
lines changed

build/NuSpecs/UmbracoCms.Core.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<dependency id="AutoMapper" version="[3.0.0, 4.0.0)" />
3232
<dependency id="Newtonsoft.Json" version="[4.5.11, 5.0.0)" />
3333
<dependency id="ImageProcessor" version="[1.8.7, 2.0.0)" />
34-
<dependency id="ImageProcessor.Web" version="[3.2.0, 4.0.0)" />
34+
<dependency id="ImageProcessor.Web" version="[3.2.1, 4.0.0)" />
3535
</dependencies>
3636
</metadata>
3737
<files>

src/Umbraco.Core/Services/IRelationService.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,43 @@ public interface IRelationService : IService
6363
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
6464
IEnumerable<IRelation> GetByParentId(int id);
6565

66+
/// <summary>
67+
/// Gets a list of <see cref="Relation"/> objects by their parent entity
68+
/// </summary>
69+
/// <param name="parent">Parent Entity to retrieve relations for</param>
70+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
71+
IEnumerable<IRelation> GetByParent(IUmbracoEntity parent);
72+
73+
/// <summary>
74+
/// Gets a list of <see cref="Relation"/> objects by their parent entity
75+
/// </summary>
76+
/// <param name="parent">Parent Entity to retrieve relations for</param>
77+
/// <param name="relationTypeAlias">Alias of the type of relation to retrieve</param>
78+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
79+
IEnumerable<IRelation> GetByParent(IUmbracoEntity parent, string relationTypeAlias);
80+
6681
/// <summary>
6782
/// Gets a list of <see cref="Relation"/> objects by their child Id
6883
/// </summary>
6984
/// <param name="id">Id of the child to retrieve relations for</param>
7085
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
7186
IEnumerable<IRelation> GetByChildId(int id);
7287

88+
/// <summary>
89+
/// Gets a list of <see cref="Relation"/> objects by their child Entity
90+
/// </summary>
91+
/// <param name="child">Child Entity to retrieve relations for</param>
92+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
93+
IEnumerable<IRelation> GetByChild(IUmbracoEntity child);
94+
95+
/// <summary>
96+
/// Gets a list of <see cref="Relation"/> objects by their child Entity
97+
/// </summary>
98+
/// <param name="child">Child Entity to retrieve relations for</param>
99+
/// <param name="relationTypeAlias">Alias of the type of relation to retrieve</param>
100+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
101+
IEnumerable<IRelation> GetByChild(IUmbracoEntity child, string relationTypeAlias);
102+
73103
/// <summary>
74104
/// Gets a list of <see cref="Relation"/> objects by their child or parent Id.
75105
/// Using this method will get you all relations regards of it being a child or parent relation.
@@ -190,6 +220,23 @@ IEnumerable<Tuple<IUmbracoEntity, IUmbracoEntity>> GetEntitiesFromRelations(
190220
/// <returns>Returns <c>True</c> if any relations exists with the given Ids, otherwise <c>False</c></returns>
191221
bool AreRelated(int parentId, int childId);
192222

223+
/// <summary>
224+
/// Checks whether two items are related
225+
/// </summary>
226+
/// <param name="parent">Parent entity</param>
227+
/// <param name="child">Child entity</param>
228+
/// <returns>Returns <c>True</c> if any relations exist between the entities, otherwise <c>False</c></returns>
229+
bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child);
230+
231+
/// <summary>
232+
/// Checks whether two items are related
233+
/// </summary>
234+
/// <param name="parent">Parent entity</param>
235+
/// <param name="child">Child entity</param>
236+
/// <param name="relationTypeAlias">Alias of the type of relation to create</param>
237+
/// <returns>Returns <c>True</c> if any relations exist between the entities, otherwise <c>False</c></returns>
238+
bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias);
239+
193240
/// <summary>
194241
/// Saves a <see cref="Relation"/>
195242
/// </summary>

src/Umbraco.Core/Services/RelationService.cs

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,27 @@ public IEnumerable<IRelation> GetByParentId(int id)
128128
}
129129
}
130130

131+
/// <summary>
132+
/// Gets a list of <see cref="Relation"/> objects by their parent entity
133+
/// </summary>
134+
/// <param name="parent">Parent Entity to retrieve relations for</param>
135+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
136+
public IEnumerable<IRelation> GetByParent(IUmbracoEntity parent)
137+
{
138+
return GetByParentId(parent.Id);
139+
}
140+
141+
/// <summary>
142+
/// Gets a list of <see cref="Relation"/> objects by their parent entity
143+
/// </summary>
144+
/// <param name="parent">Parent Entity to retrieve relations for</param>
145+
/// <param name="relationTypeAlias">Alias of the type of relation to retrieve</param>
146+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
147+
public IEnumerable<IRelation> GetByParent(IUmbracoEntity parent, string relationTypeAlias)
148+
{
149+
return GetByParent(parent).Where(relation => relation.RelationType.Alias == relationTypeAlias);
150+
}
151+
131152
/// <summary>
132153
/// Gets a list of <see cref="Relation"/> objects by their child Id
133154
/// </summary>
@@ -142,6 +163,27 @@ public IEnumerable<IRelation> GetByChildId(int id)
142163
}
143164
}
144165

166+
/// <summary>
167+
/// Gets a list of <see cref="Relation"/> objects by their child Entity
168+
/// </summary>
169+
/// <param name="child">Child Entity to retrieve relations for</param>
170+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
171+
public IEnumerable<IRelation> GetByChild(IUmbracoEntity child)
172+
{
173+
return GetByChildId(child.Id);
174+
}
175+
176+
/// <summary>
177+
/// Gets a list of <see cref="Relation"/> objects by their child Entity
178+
/// </summary>
179+
/// <param name="child">Child Entity to retrieve relations for</param>
180+
/// <param name="relationTypeAlias">Alias of the type of relation to retrieve</param>
181+
/// <returns>An enumerable list of <see cref="Relation"/> objects</returns>
182+
public IEnumerable<IRelation> GetByChild(IUmbracoEntity child, string relationTypeAlias)
183+
{
184+
return GetByChild(child).Where(relation => relation.RelationType.Alias == relationTypeAlias);
185+
}
186+
145187
/// <summary>
146188
/// Gets a list of <see cref="Relation"/> objects by their child or parent Id.
147189
/// Using this method will get you all relations regards of it being a child or parent relation.
@@ -422,7 +464,7 @@ public bool AreRelated(int parentId, int childId)
422464
public bool AreRelated(int parentId, int childId, string relationTypeAlias)
423465
{
424466
var relType = GetRelationTypeByAlias(relationTypeAlias);
425-
if(relType == null)
467+
if (relType == null)
426468
return false;
427469

428470
return AreRelated(parentId, childId, relType);
@@ -445,6 +487,29 @@ public bool AreRelated(int parentId, int childId, IRelationType relationType)
445487
}
446488
}
447489

490+
/// <summary>
491+
/// Checks whether two items are related
492+
/// </summary>
493+
/// <param name="parent">Parent entity</param>
494+
/// <param name="child">Child entity</param>
495+
/// <returns>Returns <c>True</c> if any relations exist between the entities, otherwise <c>False</c></returns>
496+
public bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child)
497+
{
498+
return AreRelated(parent.Id, child.Id);
499+
}
500+
501+
/// <summary>
502+
/// Checks whether two items are related
503+
/// </summary>
504+
/// <param name="parent">Parent entity</param>
505+
/// <param name="child">Child entity</param>
506+
/// <param name="relationTypeAlias">Alias of the type of relation to create</param>
507+
/// <returns>Returns <c>True</c> if any relations exist between the entities, otherwise <c>False</c></returns>
508+
public bool AreRelated(IUmbracoEntity parent, IUmbracoEntity child, string relationTypeAlias)
509+
{
510+
return AreRelated(parent.Id, child.Id, relationTypeAlias);
511+
}
512+
448513

449514
/// <summary>
450515
/// Saves a <see cref="Relation"/>

src/Umbraco.Web.UI/Umbraco.Web.UI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
</Reference>
134134
<Reference Include="ImageProcessor.Web, Version=3.2.0.0, Culture=neutral, processorArchitecture=MSIL">
135135
<SpecificVersion>False</SpecificVersion>
136-
<HintPath>..\packages\ImageProcessor.Web.3.2.0.0\lib\net45\ImageProcessor.Web.dll</HintPath>
136+
<HintPath>..\packages\ImageProcessor.Web.3.2.1.0\lib\net45\ImageProcessor.Web.dll</HintPath>
137137
</Reference>
138138
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">
139139
<SpecificVersion>False</SpecificVersion>

src/Umbraco.Web.UI/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="ClientDependency-Mvc" version="1.7.0.4" targetFramework="net40" />
66
<package id="Examine" version="0.1.55.2941" targetFramework="net40" />
77
<package id="ImageProcessor" version="1.8.7.0" targetFramework="net45" />
8-
<package id="ImageProcessor.Web" version="3.2.0.0" targetFramework="net45" />
8+
<package id="ImageProcessor.Web" version="3.2.1.0" targetFramework="net45" />
99
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net40" />
1010
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net40" />
1111
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />

0 commit comments

Comments
 (0)