mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 11:44:41 +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;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tokens = new Dictionary<string, object> { { "Content", part.ContentItem } };
|
|
||||||
var allFielDescriptors = _projectionManager.DescribeProperties().ToList();
|
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 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(
|
var layoutComponents = contentItems.Select(
|
||||||
contentItem => {
|
contentItem => {
|
||||||
|
|
||||||
var contentItemMetadata = Services.ContentManager.GetItemMetadata(contentItem);
|
var contentItemMetadata = Services.ContentManager.GetItemMetadata(contentItem);
|
||||||
|
|
||||||
var propertyDescriptors = tokenizedDescriptors.Select(
|
var propertyDescriptors = fieldDescriptors.Select(
|
||||||
d => {
|
d => {
|
||||||
var fieldContext = new PropertyContext {
|
var fieldContext = new PropertyContext {
|
||||||
State = d.State,
|
State = FormParametersHelper.ToDynamic(d.Property.State),
|
||||||
Tokens = tokens
|
Tokens = new Dictionary<string, object> { { "Content", contentItem } }
|
||||||
};
|
};
|
||||||
|
|
||||||
return new { d.Property, Shape = d.Descriptor.Property(fieldContext, contentItem) };
|
return new { d.Property, Shape = d.Descriptor.Property(fieldContext, contentItem) };
|
||||||
|
|||||||
Reference in New Issue
Block a user