public ActionResponseId Store([FromBody] ActionRequestStoreDocument action) { var session = Program.Core.Sessions.GetSession(action.SessionId); Thread.CurrentThread.Name = $"API:{session.InstanceKey}:{Utility.GetCurrentMethod()}"; Program.Core.Log.Trace(Thread.CurrentThread.Name); var result = new ActionResponseId(); try { Guid newId = Guid.Empty; Program.Core.Documents.Store(session, action.SchemaName, action.Object, out newId); result.Id = newId; result.Success = true; } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public ActionResponseId Create([FromBody] ActionRequestCreateIndex action) { var session = Program.Core.Sessions.GetSession(action.SessionId); Thread.CurrentThread.Name = $"API:{session.InstanceKey}:{Utility.GetCurrentMethod()}"; Program.Core.Log.Trace(Thread.CurrentThread.Name); var result = new ActionResponseId(); try { Guid newId = Guid.Empty; if (Program.Core.Indexes.Exists(session, action.SchemaName, [email protected])) { throw new LeafSQLDuplicateObjectException($"An index already exist in the schema [{action.SchemaName}] with the name: [{[email protected]}]"); } Program.Core.Indexes.Create(session, action.SchemaName, action.@Object, out newId); result.Id = newId; result.Success = true; } catch (Exception ex) { result.Message = ex.Message; } return(result); }
public ActionResponseId Create([FromBody] ActionRequestDocument action) { _logger.LogDebug($"API:{MammutUtility.GetCurrentMethod()}"); var result = new ActionResponseId(); var session = _core.Session.ObtainSession(action.SessionId); try { result.Id = _core.Document.Create(session, action.Path, action.Document); result.Success = true; } catch (Exception ex) { result.Success = false; result.Message = "Call failed with an exception: " + ex.Message; _logger.LogError(result.Message); } finally { session.CommitImplicitTransaction(); } return(result); }