示例#1
0
        public static T CreateInstance <T>()
        {
            KnownServiceTypeEntry knownServiceTypeEntry = LocalServicesConfiguration.IsKnownServiceType(typeof(T));

            if (knownServiceTypeEntry == null)
            {
                throw new LocalServicesException(String.Format("Unknown service {0}", typeof(T).FullName));
            }
            return((T)Activator.CreateInstance(knownServiceTypeEntry.Service));
        }
示例#2
0
 public static void RegisterKnownServiceType(Type type, Type service)
 {
     LocalServicesConfiguration.RegisterKnownServiceType(new KnownServiceTypeEntry(type, service));
 }
示例#3
0
 public static void Configure(string fileName)
 {
     LocalServicesConfiguration.Configure(fileName);
 }
示例#4
0
 /// <summary>
 /// Will load the settings from an embedded configuration file "LocalServices.config"
 /// </summary>
 public static void Configure()
 {
     LocalServicesConfiguration.Configure();
 }