public IUserAssetEntity GetEntity(Guid guid) { return(entities.GetOrCreate(guid, () => { var element = elements.GetOrThrow(guid); Type type = UserAssetNames.GetOrThrow(element.Name.ToString()); var entity = giRetrieveOrCreate.GetInvoker(type)(guid); entity.FromXml(element, this); previews.Add(guid, new UserAssetPreviewLineEmbedded { Text = entity.ToString() !, Type = entity.GetType().ToTypeEntity(), Guid = guid, Action = entity.IsNew ? EntityAction.New : customResolutionModel.ContainsKey(entity.Guid) ? EntityAction.Different : GraphExplorer.FromRootVirtual((Entity)entity).Any(a => a.Modified != ModifiedState.Clean) ? EntityAction.Different : EntityAction.Identical, CustomResolution = customResolutionModel.TryGetCN(entity.Guid), }); return entity; }));
public ActionResult <EntityPackTS> ExecuteEntity([Required, FromBody] EntityOperationRequest request) { Entity entity; try { entity = OperationLogic.ServiceExecute(request.entity, request.GetOperationSymbol(request.entity.GetType()), request.args); } catch (IntegrityCheckException ex) { GraphExplorer.SetValidationErrors(GraphExplorer.FromRootVirtual(request.entity), ex); this.TryValidateModel(request, "request"); if (this.ModelState.IsValid) { throw ex; } return(BadRequest(this.ModelState)); } return(SignumServer.GetEntityPack(entity)); }