Skip to content

Commit

Permalink
Octane client no autofac accept octane config as param
Browse files Browse the repository at this point in the history
  • Loading branch information
gregyjames committed Jan 17, 2024
1 parent 45f2792 commit 586b4f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions OctaneEngine/EngineBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Autofac;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using OctaneEngine;

namespace OctaneEngineCore;

Expand All @@ -16,4 +17,15 @@ public static IEngine Build(ILoggerFactory factory, IConfiguration config)
var engine = engineContainer.Resolve<IEngine>();
return engine;
}

public static IEngine Build(ILoggerFactory factory, OctaneConfiguration config)
{
var containerBuilder = new ContainerBuilder();
containerBuilder.RegisterInstance(factory).As<ILoggerFactory>();
containerBuilder.RegisterInstance(config).As<OctaneConfiguration>();
containerBuilder.AddOctane();
var engineContainer = containerBuilder.Build();
var engine = engineContainer.Resolve<IEngine>();
return engine;
}
}

0 comments on commit 586b4f0

Please sign in to comment.