Skip to content

Commit d211da8

Browse files
authored
Merge pull request #6579 from glombek/patch-3
Correct usage of GetModelPropertyType and GetModelContentType methods
2 parents 360ea02 + 8a25cc7 commit d211da8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

13/umbraco-cms/reference/templating/modelsbuilder/understand-and-extend.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ public partial class TextPage : PublishedContentModel
4545
What is important is the `Header` property. The rest is (a) a constructor and (b) some static helpers to get the `PublishedContentType` and the `PublishedPropertyType` objects:
4646

4747
```csharp
48-
var contentType = TextPage.GetModelContentType(); // is a PublishedContentType
49-
var propertyType = TextPage.GetModelPropertyType(x => x.Header); // is a PublishedPropertyType
48+
var contentType = TextPage.GetModelContentType(_publishedSnapshotAccessor); // is a PublishedContentType
49+
var propertyType = TextPage.GetModelPropertyType(_publishedSnapshotAccessor, x => x.Header); // is a PublishedPropertyType
50+
51+
// Where _publishedSnapshotAccessor is an injected IPublishedSnapshotAccessor service
5052
```
5153

5254
## Composition and Inheritance

0 commit comments

Comments
 (0)