Exemple #1
0
        public void Create([FromBody] TenantModel model)
        {
            if (!IsDefault())
            {
                throw this.Exception("非默认上下文禁止此操作");
            }

            if (ModelState.IsValid)
            {
                ValidateViewModel(model, true);
            }
            else
            {
                throw this.Exception(ModelState);
            }

            if (!ModelState.IsValid)
            {
                throw this.Exception(ModelState);
            }

            var engineSettings = new EngineSettings()
            {
                Name             = model.Name,
                RequestUrlPrefix = model.RequestUrlPrefix?.Trim(),
                RequestUrlHost   = model.RequestUrlHost,
                ConnectionString = model.ConnectionString,
                TablePrefix      = model.TablePrefix,
                DatabaseProvider = model.DatabaseProvider,
                State            = TenantStates.Uninitialized
            };

            _engineSettingsManager.SaveSettings(engineSettings);
            _engineHost.GetOrCreateEngineContext(engineSettings);
        }
Exemple #2
0
 public void UpdateEngineSettings(EngineSettings settings)
 {
     _engineSettingsManager.SaveSettings(settings);
     ReloadEngineContext(settings);
 }