public static void Init(IInitializable initializable) { if (initializable != null) { initializable.Init(); } }
private void Start() { for (int i = 0; i < ScriptsToInitialiseReferences.Length; i++) { IInitializable init = (IInitializable)ScriptsToInitialiseReferences[i]; init.Init(); } }
public void AddInitializable(IInitializable initializable) { _initializables?.Push(initializable); if (_hasBeenInitialized) { initializable.Init(); } }
public void EnsureCreated() { bool isCreated = context.Database.EnsureCreated(); if (isCreated) { IInitializable initializable = context as IInitializable; initializable?.Init(databaseInitializer); } }
public virtual void Init() { for (int i = 0; i < providers.Count; i++) { IInitializable initializable = providers[i] as IInitializable; if (initializable != null) { initializable.Init(); } } }
private void DoSync(int syncType) { string className = AppEnum.GetSync(syncType); Type type = Type.GetType(className); if (type == null) //如果添加新的需要同步的类,就先在数据库里增加,在没有更新程序以前,className 应该是Unknown, Type.GetType的返回就会是null。 { return; } MethodInfo method = type.GetMethod("GetInstance"); IInitializable iInit = (IInitializable)method.Invoke(null, null); iInit.Init(); RegisterLastVersion(syncType); }