Table of Contents

Class PolicyRegistry

Namespace
Pamoja.Profile
Assembly
Pamoja.Profile.dll

What resolves a profile's control kind to the code that decides it: a built-in kind to its Controller, and a kind the library never shipped to the policy the factory registered under its name builds.

public sealed class PolicyRegistry
Inheritance
PolicyRegistry
Inherited Members

Remarks

One program then runs any manifest its registry covers.

Properties

Kinds

Gets the custom kinds registered, in name order.

public IReadOnlyList<string> Kinds { get; }

Property Value

IReadOnlyList<string>

Methods

Register(string, Func<IReadOnlyDictionary<string, object>, IPolicy>)

Registers the factory for a custom kind, replacing one of the same name.

public PolicyRegistry Register(string kind, Func<IReadOnlyDictionary<string, object>, IPolicy> factory)

Parameters

kind string

The kind as a manifest names it, such as frost_guard.

factory Func<IReadOnlyDictionary<string, object>, IPolicy>

Builds the policy from the parameters beside the kind, each a double, a bool, or a string.

Returns

PolicyRegistry

The registry, for chaining.

Resolve(Profile)

Resolves a profile's control kind to the policy that decides it.

public IPolicy Resolve(Profile profile)

Parameters

profile Profile

The profile whose kind is resolved.

Returns

IPolicy

A fresh policy; a built-in kind's Controller is the caller's to dispose.

Exceptions

PamojaException

The kind is custom and no factory is registered for it, naming the kind and the one it was probably meant to be.