Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 67e7f49

Browse files
committed
fix: lazy dependencies for DataValueReference
1 parent bbe2a7b commit 67e7f49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Our.Umbraco.DocTypeGridEditor/ValueProcessing/DocTypeGridEditorDataValueReference.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ namespace Our.Umbraco.DocTypeGridEditor.ValueProcessing
1717
public class DocTypeGridEditorDataValueReference : IDataValueReferenceFactory, IDataValueReference
1818
{
1919
private readonly Lazy<Dictionary<string, IContentType>> _contentTypes;
20-
private readonly PropertyEditorCollection _dataEditors;
20+
private readonly Lazy<PropertyEditorCollection> _dataEditors;
2121

2222
public IDataValueReference GetDataValueReference() => this;
2323

2424
public bool IsForEditor(IDataEditor dataEditor) => dataEditor.Alias.InvariantEquals(Constants.PropertyEditors.Aliases.Grid);
2525

2626

27-
public DocTypeGridEditorDataValueReference(IContentTypeService contentTypeService, PropertyEditorCollection dataEditors)
27+
public DocTypeGridEditorDataValueReference(Lazy<IContentTypeService> contentTypeService, Lazy<PropertyEditorCollection> dataEditors)
2828
{
29-
_contentTypes = new Lazy<Dictionary<string, IContentType>>(() => contentTypeService.GetAll().ToDictionary(c => c.Alias));
29+
_contentTypes = new Lazy<Dictionary<string, IContentType>>(() => contentTypeService.Value.GetAll().ToDictionary(c => c.Alias));
3030
_dataEditors = dataEditors;
3131
}
3232

@@ -50,7 +50,7 @@ public IEnumerable<UmbracoEntityReference> GetReferences(object value)
5050
{
5151
if (propertyTypes.TryGetValue(property.Name, out var propertyType))
5252
{
53-
if (_dataEditors.TryGet(propertyType.PropertyEditorAlias, out var propertyEditor))
53+
if (_dataEditors.Value.TryGet(propertyType.PropertyEditorAlias, out var propertyEditor))
5454
{
5555
if (propertyEditor.GetValueEditor() is IDataValueReference reference)
5656
{

0 commit comments

Comments
 (0)