Esempio n. 1
0
        /// <summary>
        /// Creates feature of this meta-feature type in specified context.
        /// </summary>
        /// <param name="serviceProvider">The context in which the new feature is created.</param>
        /// <returns>Created feature.</returns>
        /// <remarks>
        /// Note that even though feature might choose to implement IFeature interface, this is not
        /// a requirement (whereas IDisposable is a requirement).
        /// </remarks>
        public IDisposable CreateFeature(ITypedServiceProvider serviceProvider)
        {
            IDisposable disposableFeature = this.DoCreateFeature(serviceProvider);

            Debug.Assert(disposableFeature != null);

            IFeature feature = disposableFeature as IFeature;

            if (feature != null)
            {
                feature.Associate(this, serviceProvider);
            }

            Debug.WriteLine("Created feature " + this + ".");
            return(disposableFeature);
        }