Skip to content

Commit

Permalink
minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Oct 26, 2023
1 parent c597708 commit 9515ee5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ContentTypeAttribute Create(
Func<IHasMetadataSource> metaSourceFinder = null)
{
metadata = metadata ?? new ContentTypeAttributeMetadata(key: id, name: name, type: type,
sourceGuid: null, items: metadataItems, deferredSource: metaSourceFinder);
sourceGuid: sysSettings?.SourceGuid, items: metadataItems, deferredSource: metaSourceFinder);

return new ContentTypeAttribute(appId: appId, name: name, type: type, isTitle: isTitle,
attributeId: id, sortOrder: sortOrder, guid: guid, sysSettings: sysSettings, metadata: metadata);
Expand Down
28 changes: 13 additions & 15 deletions ToSic.Eav.Persistence.Efc/Efc11Loader_ContentTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,19 @@ private ImmutableList<IContentType> LoadContentTypesIntoLocalCache(int appId, IH
set.Scope,
Attributes = set.ToSicEavAttributesInSets
.Where(a => a.Attribute.ChangeLogDeleted == null) // only not-deleted attributes!
.Select(a =>
{
var nameId = a.Attribute.StaticName;
var valType = ValueTypeHelpers.Get(a.Attribute.Type);
var attributeId = a.AttributeId;

// #SharedFieldDefinition
var sysSettings = serializer.DeserializeAttributeSysSettings(a.Attribute.SysSettings);
var attrMetadata = new ContentTypeAttributeMetadata(attributeId, nameId, valType, deferredSource: () => source, sourceGuid: sysSettings?.SourceGuid);

return _dataBuilder.TypeAttributeBuilder
.Create(appId: appId, name: nameId, type: valType, isTitle: a.IsTitle, id: attributeId, sortOrder: a.SortOrder,
// #SharedFieldDefinition
metadata: attrMetadata, guid: a.Attribute.Guid, sysSettings: sysSettings);
}),
.Select(a => _dataBuilder.TypeAttributeBuilder
.Create(appId: appId,
name: a.Attribute.StaticName,
type: ValueTypeHelpers.Get(a.Attribute.Type),
isTitle: a.IsTitle,
id: a.AttributeId,
sortOrder: a.SortOrder,
// #SharedFieldDefinition
// metadata: attrMetadata,
metaSourceFinder: () => source,
guid: a.Attribute.Guid,
sysSettings: serializer.DeserializeAttributeSysSettings(a.Attribute.SysSettings)
)),
IsGhost = set.UsesConfigurationOfAttributeSet,
SharedDefinitionId = set.UsesConfigurationOfAttributeSet,
AppId = set.UsesConfigurationOfAttributeSetNavigation?.AppId ?? set.AppId,
Expand Down

0 comments on commit 9515ee5

Please sign in to comment.