private static void RegisterBase(this IRegisterableLake lake, string id, ComponentFactory factory) { if (lake is null) { throw new ArgumentNullException(nameof(lake)); } if (id is null) { throw new ArgumentNullException(nameof(id)); } if (factory is null) { throw new ArgumentNullException(nameof(factory)); } lake.RegisterComponent(id, factory); }
private static void RegisterSingletonBase(this IRegisterableLake lake, string id, ComponentFactory factory) { if (lake is null) { throw new ArgumentNullException(nameof(lake)); } if (id is null) { throw new ArgumentNullException(nameof(id)); } if (factory is null) { throw new ArgumentNullException(nameof(factory)); } var lazy = new Lazy <object?>(() => factory()); lake.RegisterComponent(id, () => lazy.Value); }