Fix up linq issues and lookup

This commit is contained in:
Elitsa Marinovska
2021-06-10 14:56:03 +02:00
parent 222d1e708a
commit b4e6222f32
2 changed files with 9 additions and 14 deletions

View File

@@ -414,22 +414,17 @@ namespace Umbraco.Web.Editors
{
var result = new Dictionary<Guid, ContentItemDisplay>();
using (var scope = _scopeProvider.CreateScope())
{
var contentTypes = Services.ContentTypeService.GetAll(contentTypeKeys).ToList();
using var scope = _scopeProvider.CreateScope(autoComplete: true);
var contentTypes = Services.ContentTypeService.GetAll(contentTypeKeys).ToList();
if (contentTypes.Any(contentType => contentType == null))
foreach (var contentType in contentTypes)
{
if (contentType is null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
foreach (var contentTypeKey in contentTypeKeys)
{
var contentType = contentTypes.First(c => c.Key == contentTypeKey);
result.Add(contentTypeKey, GetEmpty(contentType, parentId));
}
scope.Complete();
result.Add(contentType.Key, GetEmpty(contentType, parentId));
}
return result;

View File

@@ -156,15 +156,15 @@ namespace Umbraco.Web.PropertyEditors
continue;
}
if (!valEditors.ContainsKey(dataType.Id))
if (!valEditors.TryGetValue(dataType.Id, out var valEditor))
{
var tempConfig = dataType.Configuration;
var valEditor = propEditor.GetValueEditor(tempConfig);
valEditor = propEditor.GetValueEditor(tempConfig);
valEditors.Add(dataType.Id, valEditor);
}
var convValue = valEditors[dataType.Id].ToEditor(tempProp, dataTypeService);
var convValue = valEditor.ToEditor(tempProp, dataTypeService);
// update the raw value since this is what will get serialized out
row.RawPropertyValues[prop.Key] = convValue;