internal void Execute(bool upgradeDatastore, MethodInfo?unitTestScript) { if (isExecuting) { throw new InvalidOperationException("It is not allowed to call the 'Execute' method from within an upgrade script."); } try { isExecuting = true; Execute(upgradeDatastore, unitTestScript, item => true, true); lock (RegisteredModels) { if (RegisteredModels.Any(item => item.GetType() == this.GetType())) { return; } RegisteredModels.Add(this); } } finally { isExecuting = false; } }
public void RegisterModelType(Type modelType) { if (RegisteredModels == null) { RegisteredModels = new List <ModelRegister>(); } Console.WriteLine($"Registering model '{modelType.FullName}'"); RegisteredModels.Add(new ModelRegister(modelType.FullName, modelType)); }