Пример #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);
        }
        /// <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 ENTITY_FRAMEWORK
            if (serviceType == typeof(DbProviderServices))
            {
                svc = new ProfiledDbProviderServices((DbProviderServices)svc, profiler);
            }
            #endif
            return svc;
        }