/// <summary> /// Creates a new instance of an Quartz.NET server core. /// </summary> /// <returns></returns> public static QuartzServer CreateServer() { string typeName = Configuration.ServerImplementationType; Type t = Type.GetType(typeName, true); logger.Debug("Creating new instance of server type '" + typeName + "'"); QuartzServer retValue = (QuartzServer)Activator.CreateInstance(t); logger.Debug("Instance successfully created"); return(retValue); }
/// <summary> /// Main. /// </summary> public static void Main() { Database.SetInitializer <CSSoftContext>(null); // change from service account's dir to more logical one Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory); HostFactory.Run(x => { x.RunAsLocalSystem(); x.SetDescription(Configuration.ServiceDescription); x.SetDisplayName(Configuration.ServiceDisplayName); x.SetServiceName(Configuration.ServiceName); x.Service(factory => { QuartzServer server = QuartzServerFactory.CreateServer(); server.Initialize(); return(server); }); }); }