public static IEntityRecognitionInfo GetEntityRecognitionInfo(Sungero.Domain.Shared.IEntity entity) { var typeGuid = entity.GetEntityMetadata() .GetOriginal() .NameGuid.ToString(); return(EntityRecognitionInfos.GetAll(x => x.EntityId == entity.Id && x.EntityType == typeGuid) .OrderByDescending(x => x.Id).FirstOrDefault()); }
public virtual void Clone(Sungero.Domain.Shared.IEntity targetEntity) { var typeGuid = targetEntity.GetEntityMetadata() .GetOriginal() .NameGuid.ToString(); if (EntityRecognitionInfos.GetAll().Any(x => x.EntityId == targetEntity.Id && x.EntityType == typeGuid)) { return; } var clone = EntityRecognitionInfos.Copy(_obj); clone.EntityType = typeGuid; clone.Save(); }
public virtual IEntityRecognitionInfoFacts GetPreviousPropertyRecognitionResults(IArioFact fact, string propertyName) { var factLabel = GetFactLabel(fact, propertyName); var recognitionInfo = EntityRecognitionInfos.GetAll() .Where(d => d.Facts.Any(f => f.FactLabel == factLabel && f.VerifiedValue != null && f.VerifiedValue != string.Empty)) .OrderByDescending(d => d.Id) .FirstOrDefault(); if (recognitionInfo == null) { return(null); } return(recognitionInfo.Facts .Where(f => f.FactLabel == factLabel && !string.IsNullOrWhiteSpace(f.VerifiedValue)).First()); }