Class Extensions
Provides extension methods useful for working with the DDI 3 model.
Inheritance
Namespace: Algenta.Colectica.Model.Ddi.Utility
Assembly: Algenta.Colectica.Model.Ddi.dll
Syntax
public static class Extensions : object
Methods
FromUrns(IEnumerable<String>)
Converts an enumeration of DDI URNs to an enumeration of IdentifierTriples.
Declaration
public static IEnumerable<IdentifierTriple> FromUrns(this IEnumerable<string> urns)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | urns | The URNs to convert. |
Returns
Type | Description |
---|---|
IEnumerable<IdentifierTriple> | An enumeration of IdentifierTriples. |
GetDdi32FragmentRepresentation(IVersionable, Ddi32Serializer)
Gets the DDI 3.2 XML representation of the item.
Declaration
public static XElement GetDdi32FragmentRepresentation(this IVersionable item, Ddi32Serializer serializer = null)
Parameters
Type | Name | Description |
---|---|---|
IVersionable | item | The item to serialize. |
Ddi32Serializer | serializer | The serializer used to get the representation. |
Returns
Type | Description |
---|---|
XElement |
GetDdi33FragmentRepresentation(IVersionable, Ddi33Serializer)
Gets the DDI 3.3 XML representation of the item.
Declaration
public static XElement GetDdi33FragmentRepresentation(this IVersionable item, Ddi33Serializer serializer = null)
Parameters
Type | Name | Description |
---|---|---|
IVersionable | item | The item to serialize. |
Ddi33Serializer | serializer | The serializer used to get the representation. |
Returns
Type | Description |
---|---|
XElement |
GetDdiFragment(RepositoryItem, DDIWorkflowDeserializer)
Gets a DDIFragment representing the specified repository item.
Declaration
public static DdiFragment GetDdiFragment(this RepositoryItem item, DDIWorkflowDeserializer deserializer = null)
Parameters
Type | Name | Description |
---|---|---|
RepositoryItem | item | The repository item. |
DDIWorkflowDeserializer | deserializer | The deserializer. |
Returns
Type | Description |
---|---|
DdiFragment | The DDIFragment. |
GetDdiFragmentRepresentation(IVersionable, DDIWorkflowSerializer, XmlDocument)
Gets the DDI 3.1 XML representation of the item.
Declaration
public static XmlElement GetDdiFragmentRepresentation(this IVersionable item, DDIWorkflowSerializer serializer = null, XmlDocument doc = null)
Parameters
Type | Name | Description |
---|---|---|
IVersionable | item | The item to serialize. |
DDIWorkflowSerializer | serializer | The serializer used to get the representation. |
XmlDocument | doc | The top-level XML document. |
Returns
Type | Description |
---|---|
XmlElement |
GetMultilingualStrings(IVersionable)
Gets a collection of all multilingual strings present in an item.
Declaration
public static Collection<MultilingualString> GetMultilingualStrings(this IVersionable item)
Parameters
Type | Name | Description |
---|---|---|
IVersionable | item | The item from which to extract multilingual strings. |
Returns
Type | Description |
---|---|
Collection<MultilingualString> | A collection of multilingual strings. |
RenameKeyIfExists<TKey, TValue>(Dictionary<TKey, TValue>, TKey, TKey)
If the specified key exists in the dictionary, remove it and add a new key with the same value as the old key.
Declaration
public static bool RenameKeyIfExists<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey fromKey, TKey toKey)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<TKey, TValue> | dictionary | The dictionary. |
TKey | fromKey | The key to remove, if present. |
TKey | toKey | The key to add. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
TKey | The type of the key. |
TValue | The type of the value. |
ToUrns(IEnumerable<IVersionable>)
Converts an enumeration of DDI IVersionable items to an enumeration of DDI URNs.
Declaration
public static IEnumerable<string> ToUrns(this IEnumerable<IVersionable> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IVersionable> | items | The DDI items to convert. |
Returns
Type | Description |
---|---|
IEnumerable<System.String> | An enumeration of DDI URNs. |
ToUrns(IEnumerable<IdentifierTriple>)
Converts an enumeration of IdentifierTriple objects to an enumeration of DDI URNs.
Declaration
public static IEnumerable<string> ToUrns(this IEnumerable<IdentifierTriple> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IdentifierTriple> | items | The identifiers to convert. |
Returns
Type | Description |
---|---|
IEnumerable<System.String> | An enumeration of DDI URNs. |
With<TResult>(XElement, Func<XElement, TResult>)
Calls a function on the XML element.
Declaration
public static TResult With<TResult>(this XElement element, Func<XElement, TResult> evaluator)
Parameters
Type | Name | Description |
---|---|---|
XElement | element | The element on which to call the function. |
Func<XElement, TResult> | evaluator | The function. |
Returns
Type | Description |
---|---|
TResult | The return value of the function. |
Type Parameters
Name | Description |
---|---|
TResult | The type returned by the function. |