コード例 #1
0
        /// <summary>
        /// Extension mechanism for additional services;  
        /// </summary>
        /// <returns>requested service provider or null.</returns>
        object IServiceProvider.GetService(Type serviceType)
        {
            IServiceProvider tailProvider = tail as IServiceProvider;
            if (tailProvider == null) return null;
            var svc = tailProvider.GetService(serviceType);
            if (svc == null) return null;

            if (serviceType == typeof(DbProviderServices))
            {
                svc = new ProfiledDbProviderServices((DbProviderServices)svc, MiniProfiler.Current);
            }
            return svc;
        }
コード例 #2
0
        /// <summary>
        /// Extension mechanism for additional services;
        /// </summary>
        /// <param name="serviceType">The service Type.</param>
        /// <returns>requested service provider or null.</returns>
        object IServiceProvider.GetService(Type serviceType)
        {
            var tailProvider = _tail as IServiceProvider;

            if (tailProvider == null)
            {
                return(null);
            }
            var svc = tailProvider.GetService(serviceType);

            if (svc == null)
            {
                return(null);
            }

            if (serviceType == typeof(DbProviderServices))
            {
                svc = new ProfiledDbProviderServices((DbProviderServices)svc, MiniProfiler.Current);
            }

            return(svc);
        }