Skip to content

Commit c096911

Browse files
committed
Add attribute to disable autowiring on a property
1 parent 3a3eeeb commit c096911

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

src/InEngine.Core/AbstractCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
using System;
22
using System.Linq;
33
using InEngine.Core.IO;
4+
using InEngine.Core.Scheduling;
45
using Konsole;
56
using Quartz;
67

78
namespace InEngine.Core
89
{
910
abstract public class AbstractCommand : ICommand, IFailed, IJob, IWrite
1011
{
12+
public Write Write { get; set; }
1113
public ProgressBar ProgressBar { get; internal set; }
1214
public string Name { get; set; }
1315
public string SchedulerGroup { get; set; }
1416
public string ScheduleId { get; set; }
15-
public Write Write { get; set; }
1617

1718
protected AbstractCommand()
1819
{

src/InEngine.Core/Commands/Echo.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using CommandLine;
1+
using CommandLine;
32

43
namespace InEngine.Core.Commands
54
{

src/InEngine.Core/Queue/Commands/Consume.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using CommandLine;
3-
using Quartz;
43

54
namespace InEngine.Core.Queue.Commands
65
{
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using System;
2+
3+
namespace InEngine.Core.Scheduling
4+
{
5+
public class DoNotAutoWireAttribute : Attribute
6+
{}
7+
}

src/InEngine.Core/Scheduling/Schedule.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Linq;
1+
using System.Linq;
32
using Quartz;
43
using Quartz.Impl;
54

@@ -16,6 +15,8 @@ public Occurence Job(AbstractCommand command)
1615
command.GetType()
1716
.GetProperties()
1817
.ToList()
18+
.Where(x => !x.GetCustomAttributes(typeof(DoNotAutoWireAttribute), true).Any())
19+
.ToList()
1920
.ForEach(x => jobDetail.JobDataMap.Add(x.Name, x.GetValue(command)));
2021

2122
return new Occurence() {

0 commit comments

Comments
 (0)