mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19583: Removing unnecesary field descriptor tokenization in projection
Work Item: 19583 --HG-- branch : 1.x
This commit is contained in:
@@ -135,21 +135,19 @@ namespace Orchard.Projections.Drivers {
|
||||
return list;
|
||||
}
|
||||
|
||||
var tokens = new Dictionary<string, object> { { "Content", part.ContentItem } };
|
||||
var allFielDescriptors = _projectionManager.DescribeProperties().ToList();
|
||||
var fieldDescriptors = layout.Properties.OrderBy(p => p.Position).Select(p => allFielDescriptors.SelectMany(x => x.Descriptors).Select(d => new { Descriptor = d, Property = p }).FirstOrDefault(x => x.Descriptor.Category == p.Category && x.Descriptor.Type == p.Type)).ToList();
|
||||
var tokenizedDescriptors = fieldDescriptors.Select(fd => new { fd.Descriptor, fd.Property, State = FormParametersHelper.ToDynamic(_tokenizer.Replace(fd.Property.State, tokens)) }).ToList();
|
||||
|
||||
var layoutComponents = contentItems.Select(
|
||||
contentItem => {
|
||||
|
||||
var contentItemMetadata = Services.ContentManager.GetItemMetadata(contentItem);
|
||||
|
||||
var propertyDescriptors = tokenizedDescriptors.Select(
|
||||
var propertyDescriptors = fieldDescriptors.Select(
|
||||
d => {
|
||||
var fieldContext = new PropertyContext {
|
||||
State = d.State,
|
||||
Tokens = tokens
|
||||
State = FormParametersHelper.ToDynamic(d.Property.State),
|
||||
Tokens = new Dictionary<string, object> { { "Content", contentItem } }
|
||||
};
|
||||
|
||||
return new { d.Property, Shape = d.Descriptor.Property(fieldContext, contentItem) };
|
||||
|
Reference in New Issue
Block a user