Skip to content

Commit ba46d7c

Browse files
committed
Updated the "IMntpConverter" interface a bit
The "Convert" method had a "source" parameter of type "object", but as the type will always be an instance of "IPublishedContent", the interface has now been updated to reflect this.
1 parent e100530 commit ba46d7c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Skybrud.Umbraco.MultiNodeTreePicker/Converters/IMntpItemConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public interface IMntpItemConverter {
99
[JsonProperty("name")]
1010
string Name { get; }
1111

12-
object Convert(IPublishedPropertyType propertyType, object source);
12+
object Convert(IPublishedPropertyType propertyType, IPublishedContent source);
1313

1414
Type GetType(IPublishedPropertyType propertyType);
1515

src/Skybrud.Umbraco.MultiNodeTreePicker/Converters/MntpGenericItemConverter.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ protected MntpGenericItemConverter(string name, Func<IPublishedContent, T> callb
1414
Callback = callback;
1515
}
1616

17-
public object Convert(IPublishedPropertyType propertyType, object source) {
18-
19-
if (source is IPublishedContent content) return Callback(content);
20-
21-
return null;
22-
17+
public virtual object Convert(IPublishedPropertyType propertyType, IPublishedContent source) {
18+
return source is null ? null : Callback(source);
2319
}
2420

25-
public Type GetType(IPublishedPropertyType propertyType) {
21+
public virtual Type GetType(IPublishedPropertyType propertyType) {
2622
return typeof(T);
2723
}
2824

0 commit comments

Comments
 (0)