Skip to content

Commit 7da592e

Browse files
authored
Merge pull request #6540 from bergmania/v15/Getall-vs-getmany
Updated docs to use GetMany vs GetAll
2 parents 839c264 + affb6d1 commit 7da592e

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

15/umbraco-cms/reference/cache/examples/tags.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,20 @@ namespace Doccers.Core.Controllers.Api;
121121
[Route("/umbraco/api/tags")]
122122
public class TagsController : Controller
123123
{
124-
private readonly ICacheTagService _tagService;
124+
private readonly ICacheTagService _cacheTagService;
125125

126126
// Dependency injection rocks!
127-
public TagsController(ICacheTagService tagService)
127+
public TagsController(ICacheTagService cacheTagService)
128128
{
129-
_tagService = tagService;
129+
_cacheTagService = cacheTagService;
130130
}
131131

132132
[HttpGet("getdefaulttags")]
133133
public IEnumerable<TagModel> GetDefaultTags()
134134
{
135135
// As mentioned earlier we want tags from "default"
136136
// group to be cached for a minute.
137-
return _tagService.GetAll("default", "defaultTags",
137+
return _cacheTagService.GetAll("default", "defaultTags",
138138
TimeSpan.FromMinutes(1));
139139
}
140140

@@ -144,7 +144,7 @@ public class TagsController : Controller
144144
// If you don't specify a TimeSpan the object(s)
145145
// will be cached until manually removed or
146146
// if the site restarts.
147-
return _tagService.GetAll("blog", "blogTags");
147+
return _cacheTagService.GetAll("blog", "blogTags");
148148
}
149149
}
150150
```

15/umbraco-cms/reference/management/using-services/contenttypeservice.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Although the use of a GUID is preferable, you can also use it's numeric ID:
2222

2323
```csharp
2424
// Get a reference to the content type by its numeric ID
25-
IContentType contentType = _contentTypeService.Get(1234);
25+
IContentType contentType = _contentTypeService.Get(1234);
2626
```
2727

2828
Finally, you can also look up a content type by its alias:
@@ -41,19 +41,18 @@ As content types are stored in a hierarchical list with folders (containers), th
4141
IEnumerable<IContentType> contentTypes = _contentTypeService.GetAll();
4242
```
4343

44-
In the example above, the method was called without any parameters. The method also has two overloads, which lets you look up a collection fo content types by either specifying their GUID or numeric IDs:
45-
44+
The service also have `GetMany`-methods to get a collection of content types by their GUIDs IDs or numeric IDs:
4645
```csharp
4746
// Get a collection of two specific content types by their GUIDs IDs
48-
IEnumerable<IContentType> contentTypes = _contentTypeService.GetAll(new[] {
47+
IEnumerable<IContentType> contentTypes = _contentTypeService.GetMany(new[] {
4948
new Guid("2b54088e-d355-4b9e-aa4b-5aec4b3f87eb"),
5049
new Guid("859c5916-19d8-4a72-9bd0-5641ad503aa9")
5150
});
5251
```
5352

5453
```csharp
5554
// Get a collection of two specific content types by their numeric IDs
56-
IEnumerable<IContentType> contentTypes = _contentTypeService.GetAll(1234, 1235);
55+
IEnumerable<IContentType> contentTypes = _contentTypeService.GetMany(1234, 1235);
5756
```
5857

5958
To get a list of all Content Types of another content type, you can use the `GetChildren` method. This can be done by specifying the numeric ID or the GUID:

0 commit comments

Comments
 (0)