/// <summary>
        /// Retorna la instancia del servicio llamado nombreServicio
        /// en el contexto
        /// </summary>
        /// <returns>Instancia del servicio solicitado</returns>
        public static T GetService()
        {
            var result = LocalizadorServicio.GetService(typeof(T));

            if (result != null)
            {
                return((T)result);
            }
            return(default(T));
        }
示例#2
0
        /// <summary>
        /// Retrieves a collection of services from the scope.
        /// </summary>
        /// <param name="serviceType">The collection of services to be retrieved.</param>
        /// <returns>The retrieved collection of services.</returns>
        public IEnumerable <object> GetServices(Type serviceType)
        {
            var services = new List <object>();
            var service  = LocalizadorServicio.GetService(serviceType, _context, false);

            if (service != null)
            {
                services.Add(service);
            }

            return(services);
        }
示例#3
0
 /// <summary>
 /// Retrieves a service from the scope.
 /// </summary>
 /// <param name="serviceType">The service to be retrieved.</param>
 /// <returns>The retrieved service.</returns>
 public object GetService(Type serviceType)
 {
     return(LocalizadorServicio.GetService(serviceType, _context, false));
 }