This repository was archived by the owner on Dec 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMigrations.cs
More file actions
48 lines (36 loc) · 1.42 KB
/
Copy pathMigrations.cs
File metadata and controls
48 lines (36 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
using OrchardCore.Recipes.Services;
using System.Threading.Tasks;
namespace Etch.OrchardCore.Search
{
public class Migrations : DataMigration
{
#region Dependencies
private readonly IContentDefinitionManager _contentDefinitionManager;
private readonly IRecipeMigrator _recipeMigrator;
#endregion
#region Constructor
public Migrations(IContentDefinitionManager contentDefinitionManager, IRecipeMigrator recipeMigrator)
{
_contentDefinitionManager = contentDefinitionManager;
_recipeMigrator = recipeMigrator;
}
#endregion
#region Migrations
public async Task<int> CreateAsync()
{
_contentDefinitionManager.AlterPartDefinition("SiteSearch", part => part
.WithDescription("Adds site search to page.")
.WithDisplayName("Site Search"));
_contentDefinitionManager.AlterPartDefinition("SearchablePart", part => part
.Attachable()
.WithDescription("Makes content type included within site search.")
.WithDisplayName("Searchable"));
await _recipeMigrator.ExecuteAsync("create.recipe.json", this);
return 1;
}
#endregion
}
}