示例#1
0
 public static void RegisterService(Type type, object service)
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     ServiceStore.RegisterService(type, service);
 }
示例#2
0
 public static void RegisterService <T> (T service) where T : class
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     ServiceStore.RegisterService(typeof(T), service);
 }
示例#3
0
        public static T GetService <T> () where T : class
        {
            object service = ServiceStore.GetService(typeof(T));

            return((T)service);
        }