Merge remote-tracking branch 'origin/6.2.0' into 7.0.0
Conflicts: src/Umbraco.Core/Persistence/Factories/UmbracoEntityFactory.cs src/Umbraco.Core/Persistence/Repositories/EntityRepository.cs
This commit is contained in:
@@ -26,6 +26,8 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
|
||||
internal UmbracoEntity BuildEntityFromDynamic(dynamic d)
|
||||
{
|
||||
var asDictionary = (IDictionary<string, object>)d;
|
||||
|
||||
var entity = new UmbracoEntity(d.trashed)
|
||||
{
|
||||
CreateDate = d.createDate,
|
||||
@@ -39,14 +41,12 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
Path = d.path,
|
||||
SortOrder = d.sortOrder,
|
||||
HasChildren = d.children > 0,
|
||||
ContentTypeAlias = d.alias ?? string.Empty,
|
||||
ContentTypeIcon = d.icon ?? string.Empty,
|
||||
ContentTypeThumbnail = d.thumbnail ?? string.Empty,
|
||||
ContentTypeAlias = asDictionary.ContainsKey("alias") ? (d.alias ?? string.Empty) : string.Empty,
|
||||
ContentTypeIcon = asDictionary.ContainsKey("icon") ? (d.icon ?? string.Empty) : string.Empty,
|
||||
ContentTypeThumbnail = asDictionary.ContainsKey("thumbnail") ? (d.thumbnail ?? string.Empty) : string.Empty,
|
||||
UmbracoProperties = new List<UmbracoEntity.UmbracoProperty>()
|
||||
};
|
||||
|
||||
var asDictionary = (IDictionary<string, object>)d;
|
||||
|
||||
var publishedVersion = default(Guid);
|
||||
//some content items don't have a published version
|
||||
if (asDictionary.ContainsKey("publishedVersion") && asDictionary["publishedVersion"] != null)
|
||||
@@ -54,7 +54,7 @@ namespace Umbraco.Core.Persistence.Factories
|
||||
Guid.TryParse(d.publishedVersion.ToString(), out publishedVersion);
|
||||
}
|
||||
var newestVersion = default(Guid);
|
||||
if (d.newestVersion != null)
|
||||
if (asDictionary.ContainsKey("newestVersion") && d.newestVersion != null)
|
||||
{
|
||||
Guid.TryParse(d.newestVersion.ToString(), out newestVersion);
|
||||
}
|
||||
|
||||
@@ -142,6 +142,15 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
yield return entity;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var dtos = _work.Database.Fetch<dynamic>(sql);
|
||||
foreach (var entity in dtos.Select(dto => factory.BuildEntityFromDynamic(dto)))
|
||||
{
|
||||
yield return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +277,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
protected virtual Sql GetBaseWhere(Func<bool, bool, string, Sql> baseQuery, bool isContent, bool isMedia, int id)
|
||||
{
|
||||
var sql = baseQuery(isContent, isMedia, " AND umbracoNode.id = '"+ id +"'")
|
||||
var sql = baseQuery(isContent, isMedia, " AND umbracoNode.id = '" + id + "'")
|
||||
.Where("umbracoNode.id = @Id", new { Id = id })
|
||||
.Append(GetGroupBy(isContent, isMedia));
|
||||
return sql;
|
||||
@@ -284,9 +293,9 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
protected virtual Sql GetBaseWhere(Func<bool, bool, string, Sql> baseQuery, bool isContent, bool isMedia, Guid nodeObjectType, int id)
|
||||
{
|
||||
var sql = baseQuery(isContent, isMedia, " AND umbracoNode.id = '"+ id +"'")
|
||||
var sql = baseQuery(isContent, isMedia, " AND umbracoNode.id = '" + id + "'")
|
||||
.Where("umbracoNode.id = @Id AND umbracoNode.nodeObjectType = @NodeObjectType",
|
||||
new {Id = id, NodeObjectType = nodeObjectType});
|
||||
new { Id = id, NodeObjectType = nodeObjectType });
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user