-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleManifest.cs
More file actions
89 lines (73 loc) · 2.49 KB
/
ModuleManifest.cs
File metadata and controls
89 lines (73 loc) · 2.49 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using Microsoft.Extensions.DependencyInjection;
namespace Modulight.Modules
{
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
/// <summary>
/// Service descriptor for module services.
/// </summary>
public record ModuleServiceDescriptor(Type ImplementationType, Type ServiceType, ServiceLifetime Lifetime = ServiceLifetime.Scoped, ServiceRegisterBehavior RegisterBehavior = ServiceRegisterBehavior.Normal)
{
}
/// <summary>
/// A entry in service collection for module manifest.
/// </summary>
/// <typeparam name="TModule"></typeparam>
/// <typeparam name="TManifest"></typeparam>
public record ModuleManifestServiceEntry<TModule, TManifest>(Type Type, TManifest Manifest) where TModule : IModule where TManifest : ModuleManifest<TModule>
{
}
#pragma warning restore CS1591 // 缺少对公共可见类型或成员的 XML 注释
/// <summary>
/// Generic manifest for modules
/// </summary>
/// <typeparam name="TModule"></typeparam>
public record ModuleManifest<TModule> where TModule : IModule
{
}
/// <summary>
/// Manifest for module
/// </summary>
public record ModuleManifest : ModuleManifest<IModule>
{
/// <summary>
/// Name
/// </summary>
public string Name { get; init; } = "";
/// <summary>
/// Display name
/// </summary>
public string DisplayName { get; init; } = "";
/// <summary>
/// Description
/// </summary>
public string Description { get; init; } = "";
/// <summary>
/// Version
/// </summary>
public string Version { get; init; } = "";
/// <summary>
/// Author
/// </summary>
public string Author { get; init; } = "";
/// <summary>
/// Project URL
/// </summary>
public string Url { get; init; } = "";
/// <summary>
/// Services
/// </summary>
public ModuleServiceDescriptor[] Services { get; init; } = Array.Empty<ModuleServiceDescriptor>();
/// <summary>
/// Options
/// </summary>
public Type[] Options { get; init; } = Array.Empty<Type>();
/// <summary>
/// Dependencies
/// </summary>
public Type[] Dependencies { get; init; } = Array.Empty<Type>();
/// <summary>
/// Full name
/// </summary>
public string FullName => $"{Name}@{Version}";
}
}