Exemple #1
0
        /// <summary>
        /// Returns an owner using a componentId.
        /// Uses IOwnershipCache to speed up lookup.
        /// </summary>
        /// <param name="cache">IOwnershipCache is cached Ownership table.</param>
        /// <param name="componentId">Id string of the component.</param>
        /// <returns>String as owner (email).</returns>
        public static async Task <string> GetOwner(this IOwnershipCache cache, string componentId)
        {
            var entries = await cache.GetEntries();

            IComponentId id = ComponentId.ComponentIdFactory(componentId);

            // more detailed component Id should be selected,
            // for this reason we first query the identity on object level.
            var objectOwner = entries.FirstOrDefault(x => x.ComponentId == id.ObjectLevel);

            if (!objectOwner.Equals(default) && !string.IsNullOrEmpty(objectOwner.Owner))