resolve tagging index issues ...
This commit is contained in:
@@ -369,6 +369,40 @@ namespace xFileService.Providers
|
|||||||
return await Task.FromResult(result);
|
return await Task.FromResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extract all Referencing Models for Specified Key ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="providedForId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<XReference<TKey>>> GetAllReferencings(TKey providedForId)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!providedForId.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var identifier = GetProvidedID(providedForId);
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = FileProvider.FileRepository
|
||||||
|
.AsQueryable()
|
||||||
|
.Where(te => te.References.Contains(identifier))
|
||||||
|
.Select(te => te.References)
|
||||||
|
.SelectMany(tr => tr.ParseXReferenceList<TKey>())
|
||||||
|
.Where(tr => tr.ProvidedFor == Provider && $"{tr.ReferencedTo}" == $"{providedForId}")
|
||||||
|
.OrderBy(tr => tr.Index)
|
||||||
|
.AsEnumerable()
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return await Task.FromResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Count References ...
|
/// Count References ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -766,6 +800,38 @@ namespace xFileService.Providers
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<IEnumerable<int>> GetReferencingIndexes(TKey providedForId)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
var isValid =
|
||||||
|
!providedForId.IsNull();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = new List<int>();
|
||||||
|
var referencings = await GetAllReferencings(providedForId);
|
||||||
|
isValid = !referencings.IsNull() &&
|
||||||
|
referencings.HasChild();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
referencings
|
||||||
|
.OrderBy(r => r.Index)
|
||||||
|
.Select(r => r.Index)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check Specified Dto is Has Reference to Provider ...
|
/// Check Specified Dto is Has Reference to Provider ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user