public async Task <IEnumerable <Link> > GetByReferenceIdAsync(Guid id) { using (var connection = context.CreateConnection()) { return(await connection.QueryAsync <Link>(LinkQuery.ByReferenceId(id))); } }
private static void SearchByComplexQuery() { var lq = new LinkQuery { LinkTypeId = "ProductItems", Direction = LinkDirection.OutBound, SourceEntityTypeId = "Product", TargetEntityTypeId = "Item" }; var AllProductsLinkedToItems = remoteManager.DataService.LinkSearch(lq, LoadLevel.DataAndLinks); var sq = new SystemQuery { Created = DateTime.Today.AddDays(-1), CreatedOperator = Operator.GreaterThan }; var complexQuery = new ComplexQuery { LinkQuery = lq, SystemQuery = sq }; var allProductsLinkedToItemsThatWasCreatedToday = remoteManager.DataService.Search(complexQuery, LoadLevel.DataAndLinks); }
public async Task DeleteAsync(Guid id) { using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(LinkQuery.Delete(id)); } }
public async Task <Link> GetByIdAsync(Guid id) { using (var connection = context.CreateConnection()) { var query = await connection.QueryAsync <Link>(LinkQuery.ById(id)); return(query.SingleOrDefault()); } }
public async Task <Link> UpdateAsync(Link link) { using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(LinkQuery.Update(link)); return(link); } }
public async Task <Link> CreateAsync(Link link) { if (link.Id == Guid.Empty) { link.Id = Guid.NewGuid(); } using (var connection = context.CreateConnection()) { await connection.ExecuteAsync(LinkQuery.Insert(link)); return(link); } }
/// <summary> /// SEARCH FOR LINKS IN PRODUCTS, ITEMS, etc. /// </summary> public void Search() { //PRODUCT/ITEMS WITH LINKS LinkQuery linqQuery = new LinkQuery(); linqQuery.LinkTypeId = "ProductItem"; linqQuery.SourceEntityTypeId = "Product"; //OUTBOUND linqQuery.TargetEntityTypeId = "Item"; //INBOUND // Gives Items as result linqQuery.Direction = LinkDirection.InBound; List <Entity> entities = RemoteManager.DataService.LinkSearch(linqQuery, LoadLevel.Shallow); // Gives Products as result linqQuery.Direction = LinkDirection.OutBound; List <Entity> entities2 = RemoteManager.DataService.LinkSearch(linqQuery, LoadLevel.Shallow); //PRODUCTS WITH NO LINKS LinkQuery lq = new LinkQuery(); lq.LinkTypeId = "ProductItem"; lq.SourceEntityTypeId = "Product"; //lq.Direction = LinkDirection.InBound; var resourceWithNoProducts = RemoteManager.DataService.LinkSearch(lq, LoadLevel.Shallow); //ITEMS WITH NO LINKS LinkQuery lq1 = new LinkQuery(); lq1.LinkTypeId = "ProductItem"; lq1.TargetEntityTypeId = "Item"; //lq1.Direction = LinkDirection.InBound; var resourceWithNoItems = RemoteManager.DataService.LinkSearch(lq1, LoadLevel.Shallow); //ITERATE ITEMS foreach (var resource in resourceWithNoItems) { var resourceFilename = RemoteManager.DataService.GetFieldValue(resource.Id, "ItemName"); var linkType = RemoteManager.ModelService.GetLinkType("ProductItem"); var unique = RemoteManager.DataService.GetEntityByUniqueValue("ItemId", "550060", LoadLevel.Shallow); } }
private static void SearchByLinkQuery() { var lq = new LinkQuery() { LinkTypeId = "ProductItem", Direction = LinkDirection.OutBound, SourceEntityTypeId = "Product", TargetEntityTypeId = "Item" }; var allProductsLinked = remoteManager.DataService.LinkSearch(lq, LoadLevel.DataAndLinks); var itemCriteria = new Criteria() { FieldTypeId = "ItemNumber", Operator = Operator.BeginsWith, Value = "X" }; lq.TargetCriteria = new List <Criteria> { itemCriteria }; var entities = remoteManager.DataService.LinkSearch(lq, LoadLevel.DataAndLinks); }
public void ResourcesLink() { LinkQuery lq = new LinkQuery() { Direction = LinkDirection.OutBound, LinkTypeId = "ItemResource", SourceEntityTypeId = "Item", TargetEntityTypeId = "Resource" }; var searchLinkQuery = RemoteManager.DataService.LinkSearch(lq, LoadLevel.Shallow); if (searchLinkQuery.Count <= 0) { AddLinkToResource(); } foreach (var item in searchLinkQuery) { var itemData = RemoteManager.DataService.GetEntityByUniqueValue("ItemId", item.DisplayName.Data.ToString(), LoadLevel.DataAndLinks); var resources = itemData.OutboundLinks.Where(c => c.LinkType.Id.Equals("ItemResource")).Select(c => c.Target).ToList(); } }
public List <Entity> LinkSearch(LinkQuery linkQuery, LoadLevel level) { throw new NotImplementedException(); }