Пример #1
0
        //---------------------------------------------------------------------------------------------------------------------

        /// <summary>Creates a new TaskScheduler instance representing the scheduler with the specified ID and based on the specified service.</summary>
        /// <param name="context">The execution environment context.</param>
        /// <param name="id">the scheduler ID</param>
        /// <param name="service">the service that created the scheduler</param>
        /// <returns>the created TaskScheduler object.</returns>
        public static SchedulerTaskConfiguration FromId(IfyContext context, int id)
        {
            EntityType entityType             = EntityType.GetOrAddEntityType(typeof(SchedulerTaskConfiguration));
            SchedulerTaskConfiguration result = (SchedulerTaskConfiguration)entityType.GetEntityInstanceFromId(context, id);

            result.Id = id;
            result.Load();
            return(result);
        }
Пример #2
0
        //---------------------------------------------------------------------------------------------------------------------

        /// <summary>Creates a new TaskScheduler instance representing the scheduler with the specified identifier.</summary>
        /// <param name="context">The execution environment context.</param>
        /// <param name="indentifier">the scheduler identifier</param>
        /// <param name="service">the processing service on which the scheduler is based</param>
        /// <returns>the created TaskScheduler object.</returns>
        public static SchedulerTaskConfiguration FromIdentifier(IfyContext context, string identifier, Service service)
        {
            EntityType entityType             = EntityType.GetOrAddEntityType(typeof(SchedulerTaskConfiguration));
            SchedulerTaskConfiguration result = (SchedulerTaskConfiguration)entityType.GetEntityInstanceFromIdentifier(context, identifier);

            result.Identifier = identifier;
            result.Load();
            if (service != null && result.ServiceId != service.Id)
            {
                throw new InvalidOperationException("The requested scheduler does not derive from this service");
            }
            return(result);
        }
Пример #3
0
        //---------------------------------------------------------------------------------------------------------------------

        /// <summary>Creates a new TaskScheduler instance representing the scheduler with the specified ID and based on the specified service.</summary>
        /// <param name="context">The execution environment context.</param>
        /// <param name="id">the scheduler ID</param>
        /// <param name="service">the service that created the scheduler</param>
        /// <returns>the created TaskScheduler object.</returns>
        public static SchedulerTaskConfiguration FromTask(IfyContext context, Task task, int typeId)
        {
            SchedulerTaskConfiguration result = GetInstance(context);

            result.Service             = task.Service;
            result.ComputingResourceId = task.ComputingResourceId;
            result.PublishServerId     = task.PublishServerId;
            result.Name        = String.Format("Scheduler from {0}", task.Name);
            result.Priority    = task.Priority;
            result.Compression = task.Compression;
            //result.LoadTaskParameters(task);

            return(result);
        }
Пример #4
0
        //---------------------------------------------------------------------------------------------------------------------

        public static SchedulerTaskConfiguration ForService(IfyContext context, Service service)
        {
            SchedulerTaskConfiguration result = new SchedulerTaskConfiguration(context, service);

            return(result);
        }