Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static void RemoveService(IPropertyOwner propertyOwner, ref Guid guidService)
        {
            var sm = ServiceManager.FromPropertyOwner(propertyOwner);

            Debug.Assert(sm != null);

            sm.RemoveService(ref guidService);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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>());
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }