Repository navigation
Expand file tree
/
Copy pathScriptingApiNamespaceAttribute.cs
More file actions
57 lines (52 loc) · 2.05 KB
/
Copy pathScriptingApiNamespaceAttribute.cs
File metadata and controls
57 lines (52 loc) · 2.05 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
using System;
namespace Inno.Scripting.Api;
/// <summary>
/// Maps a stable script-facing API namespace to one CLR implementation namespace.
/// </summary>
/// <remarks>
/// Multiple implementation namespaces can map to the same script API namespace. This keeps
/// script organization stable without introducing wrapper types with different runtime identities.
/// A feature assembly may declare a mapping for a dependency namespace when that feature owns the
/// decision to expose selected dependency types.
/// </remarks>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ScriptingApiNamespaceAttribute : Attribute
{
/// <summary>
/// Creates a script API namespace mapping.
/// </summary>
/// <param name="name">
/// The stable script API namespace, such as <c>InnoEngine.Scene</c>.
/// </param>
/// <param name="implementationNamespace">
/// The CLR namespace containing exported runtime types.
/// </param>
/// <param name="scope">
/// The script profile that receives the mapping.
/// </param>
public ScriptingApiNamespaceAttribute(
string name,
string implementationNamespace,
ScriptingApiScope scope
) {
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("A script API namespace is required.", nameof(name));
if (string.IsNullOrWhiteSpace(implementationNamespace))
throw new ArgumentException("An implementation namespace is required.", nameof(implementationNamespace));
this.name = name;
this.implementationNamespace = implementationNamespace;
this.scope = scope;
}
/// <summary>
/// Gets the stable script API namespace.
/// </summary>
public string name { get; }
/// <summary>
/// Gets the CLR namespace that implements the script API namespace.
/// </summary>
public string implementationNamespace { get; }
/// <summary>
/// Gets the script profile that receives the mapping.
/// </summary>
public ScriptingApiScope scope { get; }
}