Avalanche.Identity
Avalanche.Identity is a class library for managing object and type identities across type schemas in a generalized interface.
The design principle is that identity is deconstructed into parts. Parts can then be processed in case-specific way. The most typical case is comparison of context-free and context-dependent identities.
// Get Type
Type type = typeof(System.Collections.Generic.List<System.String>);
// Create type identity
IIdentity id = IdentityAccessors.Default.TypeName.Create(type);
"List`1" → "Generic" → "Collections" → "System" → "6.0.0.0" → "System.Private.CoreLib" → 7cec85d7bea7798e → "neutral" └── "String" → "System" → "6.0.0.0" → "System.Private.CoreLib" → 7cec85d7bea7798e → "neutral"
Identities are deconstructed into linked list. Typical identities have namespaces, which constitute a trie structure when identities are interned.
Features
Library addesses following issues:
- Generalized way to process identities of different type schemas.
- Comparison of context-free and context-dependent identities.
Features:
- Deconstruct and construct identities
- Serialization, deserialization
- Printing, parsing
- Interning
- Comparability
- Interoperability across type schemas
Class libraries:
- Avalanche.Identity.Abstractions - Interfaces and abstractions.
- Avalanche.Identity - implementations.
Interoperability:
- .NET 76.0 and upwards.
Quick bits
Identities.CreateName() creates name identity.
IIdentity identity = Identities.CreateName("Name");
Identities.CreateNamespace() creates namespace identity.
IIdentity identity = Identities.CreateNamespace("Namespace").AppendName("Name");
.Print() prints into parseable string.
string name = identity.Print();