public class ConsoleRegistry : Registry
{
public ConsoleRegistry()
{
Scan(scan =>
{
scan.TheCallingAssembly();
scan.WithDefaultConventions();
});
For<IJobFactory>().Use<StructureMapJobFactory>();
For<ISchedulerFactory>().Use(ctx => new StdSchedulerFactory());
/*For<IScheduler>().Use(async delegate (IContext ctx)
{
var scheduler = await ctx.GetInstance<ISchedulerFactory>().GetScheduler();
scheduler.JobFactory = ctx.GetInstance<IJobFactory>();
return scheduler;
});*/
ForSingletonOf<IScheduler>().Use(ctx =>
{
IScheduler scheduler = ctx.GetInstance<ISchedulerFactory>().GetScheduler().Result;
scheduler.JobFactory = ctx.GetInstance<IJobFactory>();
return scheduler;
});
}
最后有什么问题 ForSingletonOf<IScheduler>()...
?
我收到此错误
错误 CS0832 表达式树可能不包含赋值运算符