コード例 #1
0
 public void ChangeSchedule(SchedulePart s, bool check)
 {
     if (check)
     {
         _context.ScheduleParts.Find(s.Id).IsChecked = check;
     }
     else
     {
         _context.ScheduleParts.Remove(_context.ScheduleParts.Find(s.Id));
     }
 }
コード例 #2
0
 /// <summary>
 /// Registers a job to be executed using Autofac as resolving container.
 /// </summary>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="serviceName">The name used when registering the component with Autofac.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run(this SchedulePart part, string serviceName)
 {
     return(part.With(() => RootContainer.BeginLifetimeScope()).Run(c => c.ResolveNamed <ICronJob>(serviceName)));
 }
コード例 #3
0
 /// <summary>
 /// Registers a job to be executed using Autofac as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part)
     where TJob : ICronJob
 {
     return(part.With(() => RootContainer.BeginLifetimeScope()).Run(c => c.Resolve <TJob>()));
 }
コード例 #4
0
 public void AddSchedule(SchedulePart s)
 {
     _context.ScheduleParts.Add(s);
 }
コード例 #5
0
        /// <summary>
        /// Registers a job for execution using the job type as parameter.
        /// </summary>
        /// <param name="part">The fluent part upon which the job is to be registered.</param>
        /// <param name="jobType">The type of the job to be created.</param>
        /// <returns>A part that allows chained fluent method calls.</returns>
        public static JobPart Run(this SchedulePart part, Type jobType)
        {
            var constructor = jobType.GetConstructor(NoFormalArguments);

            return(part.Run(() => (ICronJob)constructor.Invoke(NoActualArguments)));
        }
コード例 #6
0
        /// <summary>
        /// Registers a job for execution using the job type name as parameter.
        /// </summary>
        /// <param name="part">The fluent part upon which the job is to be registered.</param>
        /// <param name="jobType">The fully qualified type name of the job (including assembly name if from seperate assembly).</param>
        /// <returns>A part that allows chained fluent method calls.</returns>
        public static JobPart Run(this SchedulePart part, string jobType)
        {
            var type = Type.GetType(jobType, true, false);

            return(part.Run(type));
        }
コード例 #7
0
 /// <summary>
 /// Registers a job to be executed using LightCore as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="activatorFunction">The activator function to which the object creation is delegated.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part, Func <IContainer, TJob> activatorFunction)
     where TJob : ICronJob
 {
     return(part.With(() => LightCoreContainer.GetContainer()).Run(c => c.Resolve <TJob>(activatorFunction)));
 }
コード例 #8
0
 /// <summary>
 /// Registers a job to be executed using LightCore as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="namedArguments">The named arguments that are injected into the resolved type.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part, IDictionary <string, object> namedArguments)
     where TJob : ICronJob
 {
     return(part.With(() => LightCoreContainer.GetContainer()).Run(c => c.Resolve <TJob>(namedArguments)));
 }
コード例 #9
0
 /// <summary>
 /// Registers a job to be executed using LightCore as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="arguments">The arguments that are injected into the resolved type.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part, IEnumerable <object> arguments)
     where TJob : ICronJob
 {
     return(part.With(() => LightCoreContainer.GetContainer()).Run(c => c.Resolve <TJob>(arguments)));
 }
コード例 #10
0
 /// <summary>
 /// Registers a job to be executed using LightCore as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="namedArguments">The named arguments that are injected into the resolved type.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part, AnonymousArgument namedArguments)
     where TJob : ICronJob
 {
     return(part.With(() => LightCoreContainer.GetContainer()).Run(c => c.Resolve <TJob>(namedArguments)));
 }
コード例 #11
0
 /// <summary>
 /// Registers a job to be executed using LightCore as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part)
     where TJob : ICronJob
 {
     return(part.With(() => LightCoreContainer.GetContainer()).Run(c => c.Resolve <TJob>()));
 }
コード例 #12
0
 /// <summary>
 /// Registers a job to be executed using LightCore as resolving container.
 /// </summary>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="contractType">The contract type which is resolved from the container.</param>
 /// <param name="arguments">The named arguments that are injected into the resolved type.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run(this SchedulePart part, Type contractType, IDictionary <string, object> arguments)
 {
     return(part.With(() => LightCoreContainer.GetContainer()).Run(c => c.Resolve(contractType, arguments) as ICronJob));
 }
コード例 #13
0
 /// <summary>
 /// Registers a job for execution using the job type as generic parameter.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/> and must have a default (parameterless) constructor.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part)
     where TJob : ICronJob, new()
 {
     return(part.Run(() => new TJob()));
 }
コード例 #14
0
ファイル: AutofacIntegration.cs プロジェクト: ventis07/ncron
 /// <summary>
 /// Registers a job to be executed using Autofac as resolving container.
 /// </summary>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <param name="serviceName">The name used when registering the component with Autofac.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run(this SchedulePart part, string serviceName)
 {
     return(part.With(() => RootContainer.CreateInnerContainer()).Run(c => c.Resolve <ICronJob>(serviceName)));
 }
コード例 #15
0
ファイル: AutofacIntegration.cs プロジェクト: ventis07/ncron
 /// <summary>
 /// Registers a job to be executed using Autofac as resolving container.
 /// </summary>
 /// <typeparam name="TJob">The type of job to be registered. Must implement <see cref="ICronJob"/>.</typeparam>
 /// <param name="part">The fluent part upon which the job is to be registered.</param>
 /// <returns>A part that allows chained fluent method calls.</returns>
 public static JobPart Run <TJob>(this SchedulePart part)
     where TJob : ICronJob
 {
     return(part.With(() => RootContainer.CreateInnerContainer()).Run(c => c.Resolve <TJob>()));
 }