Simplifies the includeAllVersions check

This commit is contained in:
Shannon
2017-02-24 14:00:38 +11:00
parent 28f0ab1001
commit 8122c0b352
2 changed files with 9 additions and 16 deletions

View File

@@ -998,29 +998,15 @@ ORDER BY doc2.updateDate DESC
contentTypes[dto.ContentVersionDto.ContentDto.ContentTypeId] = contentType;
}
if (includeAllVersions)
// track the definition and if it's successfully added or updated then processed
if (defs.AddOrUpdate(new DocumentDefinition(dto, contentType)))
{
// track the definition
defs.Add(new DocumentDefinition(dto, contentType));
// assign template
if (dto.TemplateId.HasValue && dto.TemplateId.Value > 0)
templateIds.Add(dto.TemplateId.Value);
content.Add(ContentFactory.BuildEntity(dto, contentType, publishedDto));
}
else
{
// track the definition and if it's successfully added or updated then processed
if (defs.AddOrUpdate(new DocumentDefinition(dto, contentType)))
{
// assign template
if (dto.TemplateId.HasValue && dto.TemplateId.Value > 0)
templateIds.Add(dto.TemplateId.Value);
content.Add(ContentFactory.BuildEntity(dto, contentType, publishedDto));
}
}
}
// load all required templates in 1 query

View File

@@ -812,6 +812,13 @@ ORDER BY contentNodeId, propertytypeid
/// <returns></returns>
public bool AddOrUpdate(DocumentDefinition item)
{
//if we are including all versions then just add, we aren't checking for latest
if (_includeAllVersions)
{
base.Add(item);
return true;
}
if (Dictionary == null)
{
base.Add(item);