last works on content ...
This commit is contained in:
@@ -23,5 +23,8 @@ namespace xContentService.Constants
|
|||||||
//
|
//
|
||||||
// EF Repositories Helper Extensions ...
|
// EF Repositories Helper Extensions ...
|
||||||
public const string GetXContentEFRepositoryDescriptor = "GetXContentEFRepositoryDescriptor";
|
public const string GetXContentEFRepositoryDescriptor = "GetXContentEFRepositoryDescriptor";
|
||||||
|
|
||||||
|
public const string XContentTitleIdentifier = "CntnT";
|
||||||
|
public const string XContentDescriptionIdentifier = "CntnD";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+32
-15
@@ -1,21 +1,25 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using System;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using xCommons.Extensions;
|
|
||||||
using xContentService.Constants;
|
|
||||||
using xContentService.Providers.Dtos;
|
|
||||||
using xContentService.Providers.Entities;
|
|
||||||
using xDataService.Constants;
|
|
||||||
using xDataService.Models;
|
|
||||||
using xPushService.DI;
|
using xPushService.DI;
|
||||||
using xDataService.DI;
|
using xDataService.DI;
|
||||||
using xPushService.Helpers;
|
|
||||||
using System;
|
|
||||||
using xExceptions.Constants;
|
|
||||||
using xContentService.Helpers;
|
|
||||||
using xCommons.Helpers;
|
|
||||||
using xContentService.Interfaces.Dtos;
|
|
||||||
using xContentService.Interfaces.Entities;
|
|
||||||
using xDataService.Db;
|
using xDataService.Db;
|
||||||
|
using xCommons.Helpers;
|
||||||
|
using xDataService.Models;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xPushService.Helpers;
|
||||||
|
using xExceptions.Constants;
|
||||||
|
using xDataService.Constants;
|
||||||
|
using xContentService.Helpers;
|
||||||
|
using xContentService.Constants;
|
||||||
|
using xContentService.Providers;
|
||||||
|
using xContentService.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using xContentService.Providers.Dtos;
|
||||||
|
using xContentService.Interfaces.Dtos;
|
||||||
|
using xContentService.Providers.Entities;
|
||||||
|
using xContentService.Interfaces.Entities;
|
||||||
|
using xContentService.Providers.Enrichers;
|
||||||
|
using xContentService.Interfaces.Enrichers;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace xContentService.DI
|
namespace xContentService.DI
|
||||||
{
|
{
|
||||||
@@ -205,6 +209,19 @@ namespace xContentService.DI
|
|||||||
descriptor: descriptor
|
descriptor: descriptor
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
services.Add(
|
||||||
|
new ServiceDescriptor(typeof(IXContentTitleResourceProvider), typeof(XContentTitleResourceProvider), lifeTime)
|
||||||
|
);
|
||||||
|
services.Add(
|
||||||
|
new ServiceDescriptor(typeof(IXContentDescriptionResourceProvider), typeof(XContentDescriptionResourceProvider), lifeTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
services.Add(
|
||||||
|
new ServiceDescriptor(typeof(IXContentEnricher), typeof(XContentEnricher), lifeTime)
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register Dto Services ...
|
// Register Dto Services ...
|
||||||
services.Add(
|
services.Add(
|
||||||
|
|||||||
@@ -1,10 +1,60 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xDataService.Interfaces;
|
||||||
|
using System.Collections.Generic;
|
||||||
using xContentService.Models.Dtos;
|
using xContentService.Models.Dtos;
|
||||||
using xContentService.Models.Entities;
|
using xContentService.Models.Entities;
|
||||||
using xDataService.Interfaces;
|
|
||||||
|
|
||||||
namespace xContentService.Interfaces.Dtos
|
namespace xContentService.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
public interface IXContentRepositoryService : IXBaseRepositoryService<XContent, XContentDto, Guid>
|
public interface IXContentRepositoryService : IXBaseRepositoryService<XContent, XContentDto, Guid>
|
||||||
{ }
|
{
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XContentDto> Enrich(
|
||||||
|
XContent source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XContentDto> Enrich(
|
||||||
|
XContentDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContent> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContentDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,58 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using xContentService.Models.Dtos;
|
||||||
|
using xContentService.Models.Entities;
|
||||||
|
|
||||||
namespace xContentService.Interfaces.Enrichers
|
namespace xContentService.Interfaces.Enrichers
|
||||||
{
|
{
|
||||||
// TODO: Complete this ...
|
|
||||||
public interface IXContentEnricher
|
public interface IXContentEnricher
|
||||||
{ }
|
{
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XContentDto> Enrich(
|
||||||
|
XContent source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XContentDto> Enrich(
|
||||||
|
XContentDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContent> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContentDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
using xStringService.Interfaces;
|
||||||
|
|
||||||
|
namespace xContentService.Interfaces
|
||||||
|
{
|
||||||
|
public interface IXContentDescriptionResourceProvider : IXItemResourceProvider
|
||||||
|
{ }
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace xContentService.Interfaces
|
||||||
|
{
|
||||||
|
public interface IXContentProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
using xStringService.Interfaces;
|
||||||
|
|
||||||
|
namespace xContentService.Interfaces
|
||||||
|
{
|
||||||
|
public interface IXContentTitleResourceProvider : IXItemResourceProvider
|
||||||
|
{ }
|
||||||
|
}
|
||||||
@@ -1,26 +1,174 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using xContentService.Interfaces.Dtos;
|
using System.Linq;
|
||||||
using xContentService.Interfaces.Entities;
|
using xModels.Dtos;
|
||||||
using xContentService.Models.Dtos;
|
using System.Threading;
|
||||||
using xContentService.Models.Entities;
|
using xCommons.Extensions;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using xContentService.Interfaces;
|
||||||
|
using xContentService.Models.Dtos;
|
||||||
|
using xIdentityService.Interfaces;
|
||||||
|
using xIdentityService.Extensions;
|
||||||
|
using xContentService.Interfaces.Dtos;
|
||||||
|
using xContentService.Models.Entities;
|
||||||
|
using xContentService.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xContentService.Providers.Dtos
|
namespace xContentService.Providers.Dtos
|
||||||
{
|
{
|
||||||
public class XContentRepositoryService : XBaseRepositoryService<XContent, XContentDto, Guid>, IXContentRepositoryService
|
public class XContentRepositoryService : XBaseRepositoryService<XContent, XContentDto, Guid>, IXContentRepositoryService
|
||||||
{
|
{
|
||||||
|
private readonly IXIdentityProvider identityProvider;
|
||||||
|
private readonly IXContentTitleResourceProvider titleResourceProvider;
|
||||||
|
private readonly IXContentDescriptionResourceProvider descriptionResourceProvider;
|
||||||
|
|
||||||
public XContentRepositoryService(
|
public XContentRepositoryService(
|
||||||
IXContentRepository repository,
|
IXContentRepository repository,
|
||||||
|
IXIdentityProvider identityProvider,
|
||||||
|
IXContentTitleResourceProvider titleResourceProvider,
|
||||||
|
IXContentDescriptionResourceProvider descriptionResourceProvider,
|
||||||
IEnumerable<Profile> mapperProfiles = null
|
IEnumerable<Profile> mapperProfiles = null
|
||||||
) : base(
|
) : base(
|
||||||
repository,
|
repository,
|
||||||
mapperProfiles
|
mapperProfiles
|
||||||
)
|
)
|
||||||
{ }
|
{
|
||||||
|
this.identityProvider = identityProvider;
|
||||||
|
this.titleResourceProvider = titleResourceProvider;
|
||||||
|
this.descriptionResourceProvider = descriptionResourceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Implement Enrichers ...
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<XContentDto> Enrich(
|
||||||
|
XContent source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Mapping Default ...
|
||||||
|
var result = Mapper.Map<XContentDto>(source);
|
||||||
|
result = await Enrich(
|
||||||
|
source: result,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<XContentDto> Enrich(
|
||||||
|
XContentDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handdle Owner ...
|
||||||
|
XPersonDto owner = null;
|
||||||
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Try to Retrieve User Info ...
|
||||||
|
var device = identityProvider.GetDevice();
|
||||||
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hanlde Content Title ...
|
||||||
|
string contentTitle = string.Empty;
|
||||||
|
XResourceDto titleResource = await titleResourceProvider.GetResource(
|
||||||
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!titleResource.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
contentTitle = titleResource.Resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hanlde Content Description ...
|
||||||
|
string contentDescription = string.Empty;
|
||||||
|
XResourceDto descriptionResource = await descriptionResourceProvider.GetResource(
|
||||||
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!descriptionResource.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
contentDescription = descriptionResource.Resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attach Extracted Items ...
|
||||||
|
var result = Mapper.Map<XContentDto>(source, options =>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
options.Items[nameof(source.Owner)] = owner;
|
||||||
|
options.Items[nameof(source.Title)] = contentTitle;
|
||||||
|
options.Items[nameof(source.TitleResource)] = titleResource;
|
||||||
|
options.Items[nameof(source.Description)] = contentDescription;
|
||||||
|
options.Items[nameof(source.DescriptionResource)] = descriptionResource;
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContent> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContentDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,162 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using xModels.Dtos;
|
||||||
|
using System.Threading;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using xContentService.Interfaces;
|
||||||
|
using xContentService.Models.Dtos;
|
||||||
|
using xIdentityService.Interfaces;
|
||||||
|
using xIdentityService.Extensions;
|
||||||
|
using xContentService.Models.Entities;
|
||||||
using xContentService.Interfaces.Enrichers;
|
using xContentService.Interfaces.Enrichers;
|
||||||
|
|
||||||
namespace xContentService.Providers.Enrichers
|
namespace xContentService.Providers.Enrichers
|
||||||
{
|
{
|
||||||
public class XContentEnricher : IXContentEnricher
|
public class XContentEnricher : IXContentEnricher
|
||||||
{
|
{
|
||||||
|
private readonly IXIdentityProvider identityProvider;
|
||||||
|
private readonly IXContentTitleResourceProvider titleResourceProvider;
|
||||||
|
private readonly IXContentDescriptionResourceProvider descriptionResourceProvider;
|
||||||
|
|
||||||
|
public XContentEnricher(
|
||||||
|
IXIdentityProvider identityProvider,
|
||||||
|
IXContentTitleResourceProvider titleResourceProvider,
|
||||||
|
IXContentDescriptionResourceProvider descriptionResourceProvider
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.identityProvider = identityProvider;
|
||||||
|
this.titleResourceProvider = titleResourceProvider;
|
||||||
|
this.descriptionResourceProvider = descriptionResourceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Complete this ...
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<XContentDto> Enrich(
|
||||||
|
XContent source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Mapping Default ...
|
||||||
|
var result = source.MapConvert<XContentDto, XContent>();
|
||||||
|
result = await Enrich(
|
||||||
|
source: result,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<XContentDto> Enrich(
|
||||||
|
XContentDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handdle Owner ...
|
||||||
|
XPersonDto owner = null;
|
||||||
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Try to Retrieve User Info ...
|
||||||
|
var device = identityProvider.GetDevice();
|
||||||
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hanlde Content Title ...
|
||||||
|
string contentTitle = string.Empty;
|
||||||
|
XResourceDto titleResource = await titleResourceProvider.GetResource(
|
||||||
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!titleResource.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
contentTitle = titleResource.Resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hanlde Content Description ...
|
||||||
|
string contentDescription = string.Empty;
|
||||||
|
XResourceDto descriptionResource = await descriptionResourceProvider.GetResource(
|
||||||
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!descriptionResource.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
contentDescription = descriptionResource.Resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attach Extracted Items ...
|
||||||
|
var result = source.MapConvert();
|
||||||
|
result.Owner = owner;
|
||||||
|
result.Title = contentTitle;
|
||||||
|
result.TitleResource = titleResource;
|
||||||
|
result.Description = contentDescription;
|
||||||
|
result.DescriptionResource = descriptionResource;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContent> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<XContentDto>> EnrichRange(
|
||||||
|
IEnumerable<XContentDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using xStringService.Providers;
|
||||||
|
using xContentService.Constants;
|
||||||
|
using xContentService.Interfaces;
|
||||||
|
using xStringService.Interfaces.Dtos;
|
||||||
|
|
||||||
|
namespace xContentService.Providers
|
||||||
|
{
|
||||||
|
public class XContentDescriptionResourceProvider : XBaseItemResourceProvider, IXContentDescriptionResourceProvider
|
||||||
|
{
|
||||||
|
public XContentDescriptionResourceProvider(
|
||||||
|
IXStringServiceProvider stringProvider
|
||||||
|
) : base(
|
||||||
|
stringProvider: stringProvider,
|
||||||
|
item: XContentServiceConstants.XContentDescriptionIdentifier
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using xContentService.Interfaces;
|
||||||
|
|
||||||
|
namespace xContentService.Providers
|
||||||
|
{
|
||||||
|
public class XContentProvider : IXContentProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using xStringService.Providers;
|
||||||
|
using xContentService.Constants;
|
||||||
|
using xContentService.Interfaces;
|
||||||
|
using xStringService.Interfaces.Dtos;
|
||||||
|
|
||||||
|
namespace xContentService.Providers
|
||||||
|
{
|
||||||
|
public class XContentTitleResourceProvider : XBaseItemResourceProvider, IXContentTitleResourceProvider
|
||||||
|
{
|
||||||
|
public XContentTitleResourceProvider(
|
||||||
|
IXStringServiceProvider stringProvider
|
||||||
|
) : base(
|
||||||
|
stringProvider: stringProvider,
|
||||||
|
item: XContentServiceConstants.XContentTitleIdentifier
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="../xTagService/xTagService.csproj" />
|
<ProjectReference Include="../xTagService/xTagService.csproj" />
|
||||||
<ProjectReference Include="../xFileService/xFileService.csproj" />
|
<ProjectReference Include="../xFileService/xFileService.csproj" />
|
||||||
|
<ProjectReference Include="../xStringService/xStringService.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- For XML Documentation Support -->
|
<!-- For XML Documentation Support -->
|
||||||
|
|||||||
Reference in New Issue
Block a user