-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMigrations.cs
44 lines (33 loc) · 1.19 KB
/
Migrations.cs
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
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.Data.Migration;
using OrchardCore.Recipes.Services;
using System.Threading.Tasks;
namespace Etch.OrchardCore.Gallery
{
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()
{
await _contentDefinitionManager.AlterPartDefinitionAsync("GalleryPart", part => part
.Reusable()
.Attachable()
.WithDescription("Create a collection of media items."));
await _recipeMigrator.ExecuteAsync("create.recipe.json", this);
return 1;
}
#endregion
}
}