Пример #1
0
        public static void RemoveService <T>(IPropertyOwner propertyOwner, IContentType contentType) where T : class
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            Debug.Assert(sm != null);

            sm.RemoveService <T>(contentType);
        }
Пример #2
0
        public static void RemoveService(IPropertyOwner propertyOwner, ref Guid guidService)
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            Debug.Assert(sm != null);

            sm.RemoveService(ref guidService);
        }
Пример #3
0
        /// <summary>
        /// Add service to a service manager associated with a particular property owner.
        /// Typically used to store services implemented in native code and identified by
        /// the interface GUID.
        /// </summary>
        /// <typeparam name="serviceGuid">Service GUID</typeparam>
        /// <param name="serviceInstance">Service instance</param>
        /// <param name="propertyOwner">Property owner</param>
        public static void AddService(ref Guid serviceGuid, object serviceInstance, IPropertyOwner propertyOwner)
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            Debug.Assert(sm != null);

            sm.AddService(ref serviceGuid, serviceInstance);
        }
Пример #4
0
        /// <summary>
        /// Add content type specific service to a service manager associated with a particular Property owner
        /// </summary>
        /// <typeparam name="T">Service type</typeparam>
        /// <param name="serviceInstance">Service instance</param>
        /// <param name="propertyOwner">Property owner</param>
        /// <param name="contentType">Content type of the service</param>
        public static void AddService <T>(T serviceInstance, IPropertyOwner propertyOwner, IContentType contentType) where T : class
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            Debug.Assert(sm != null);

            sm.AddService <T>(serviceInstance, contentType);
        }
Пример #5
0
        /// <summary>
        ///  Retrieves service from a service manager for this Property owner given service type and content type
        /// </summary>
        /// <typeparam name="T">Service type</typeparam>
        /// <param name="propertyOwner">Property owner</param>
        /// <param name="contentType">Content type</param>
        /// <returns>Service instance</returns>
        public static T GetService <T>(IPropertyOwner propertyOwner, IContentType contentType) where T : class
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            if (sm != null)
            {
                return(sm.GetService <T>(contentType));
            }

            return(null);
        }
Пример #6
0
        public static ICollection <T> GetAllServices <T>(IPropertyOwner propertyOwner) where T : class
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            if (sm != null)
            {
                return(sm.GetAllServices <T>());
            }

            return(new List <T>());
        }
Пример #7
0
        public static object GetService(IPropertyOwner propertyOwner, ref Guid serviceGuid)
        {
            try {
                var sm = ServiceManager.FromPropertyOwner(propertyOwner);
                Debug.Assert(sm != null);

                return(sm.GetService(ref serviceGuid));
            } catch (Exception) {
                return(null);
            }
        }
Пример #8
0
        public static T GetService <T>(IPropertyOwner propertyOwner) where T : class
        {
            try {
                var sm = ServiceManager.FromPropertyOwner(propertyOwner);
                Debug.Assert(sm != null);

                return(sm.GetService <T>());
            } catch (Exception) {
                return(null);
            }
        }