// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { var options = new CodeDiOptions(); Configuration.Bind("CodeDiOptions", options); services.AddCoreDi(options); services.AddMvc(); }
public void ParseOptionsToCodeDi() { var options = new CodeDiOptions() { DefaultServiceLifetime = ServiceLifetime.Scoped, AssemblyNames = new [] { "*CodeDi" }, AssemblyPaths = new [] { "C:\\MyBox\\Github\\CodeDI\\CodeDI\\bin\\Debug\\netstandard2.0" }, IgnoreAssemblies = new [] { "*Test" }, IncludeSystemAssemblies = false, IgnoreInterface = new [] { "*Say" }, InterfaceMappings = new Dictionary <string, string>() { { "*Say", "*English" } }, ServiceLifeTimeMappings = new Dictionary <string, ServiceLifetime>() { { "*Say", ServiceLifetime.Singleton } } }; var json = JsonConvert.SerializeObject(options); Console.WriteLine(json); }