public override void Run() { using (Context context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.AutoCommit)) { EntityFactory ef = new EntityFactory(context); Federation f = (Federation)ef.LoadStronglyTypedEntity(Federation.AppSettings.FederationName); QueryFactory qf = new SqlQueryFactory(); QueryBase query = qf.CreateQuery(File.ReadAllText(inputFile), ExecutionMode.Graywulf, outputTable, taskName); string queuename = String.Format("{0}.{1}", f.ControllerMachine.GetFullyQualifiedName(), queueName); JobInstance job = qf.ScheduleAsJob(query, queueName); job.Save(); } }
protected Guid ScheduleQueryJob(string query, QueueType queueType) { var queue = String.Format("QueueInstance:Graywulf.Controller.Controller.{0}", queueType.ToString()); using (var context = ContextManager.Instance.CreateContext(ConnectionMode.AutoOpen, TransactionMode.AutoCommit)) { SignInTestUser(context); var f = new SqlQueryFactory(context); var q = f.CreateQuery(query); var ji = f.ScheduleAsJob(q, queue, "testjob"); ji.Save(); return(ji.Guid); } }