Skip to content

Instantly share code, notes, and snippets.

@plioi
Created January 27, 2016 00:21
Show Gist options
  • Select an option

  • Save plioi/0b318fd56f9ab2b0b0e2 to your computer and use it in GitHub Desktop.

Select an option

Save plioi/0b318fd56f9ab2b0b0e2 to your computer and use it in GitHub Desktop.

Revisions

  1. plioi created this gist Jan 27, 2016.
    20 changes: 20 additions & 0 deletions IoC.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    public static class IoC
    {
    private static readonly Lazy<IContainer> Bootstrapper = new Lazy<IContainer>(Initialize, true);

    public static IContainer Container => Bootstrapper.Value;

    private static IContainer Initialize()
    {
    return new Container(cfg =>
    {
    cfg.Scan(scan =>
    {
    scan.TheCallingAssembly();
    scan.LookForRegistries();
    scan.WithDefaultConventions();
    scan.With(new ControllerConvention());
    });
    });
    }
    }