/// <summary> /// Default init op. Handy especially for integration tests /// </summary> /// /// <param name="callback">(optional) callback invoked when all services have completed init /// (services that implement AsyncInitService may not init immediately) /// </param> public static void Init(Action callback = null) { if (!Services.exists) { ServiceLoader.FindOrCreate <ServiceLoader>().LoadServices(true, callback); return; } if (Services.Get.hasInit) { if (callback != null) { callback(); } return; } if (Services.Get.isInitInProgress) { if (callback == null) { return; } Services.InitStatusUpdated.AddListener(s => { callback(); }); return; } ServiceLoader.FindOrCreate <ServiceLoader>().LoadServices(true, callback); }
virtual protected void SetServiceRegistrations() { FindAutowireServiceRegistrations(); // defaults FindFactoryServiceRegistrations(); // code based registrations in an app-specific serviceloader FindSceneServiceRegistrations(); // serviceloader was preconfigured into a unity scene with children that are service components if (ServiceLoader.onAfterSetServiceRegistratonsStatic != null) { ServiceLoader.onAfterSetServiceRegistratonsStatic(this); } if (this.onAfterSetServiceRegistratons != null) { this.onAfterSetServiceRegistratons(); } }
virtual public void InitService(Services serviceLocator, System.Action onCompleteCallback) { ServiceLoader.DoDefaultInitService(this, serviceLocator, onCompleteCallback); }
public void SetServiceRegistration(ServiceLoader loader) { loader.SetServiceRegistration(this, this.registrationType); }
public void SetServiceRegistration(ServiceLoader loader) { loader.SetServiceRegistration <RegistrationInterface>(this); }
public abstract void SetServiceRegistration(ServiceLoader loader);