add Interface for Reference Dtos ...
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Models;
|
||||
using xIdentityModels.Models;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xIdentityService.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// in Some Cases we have Entities Which Can Referenced for Specified
|
||||
/// Provider and Types ...
|
||||
/// this interface Globaly introduce all available Actions for those ...
|
||||
///
|
||||
/// TKey: type of Provider Models Keys ...
|
||||
/// TModel: type of Dto which Referenced ...
|
||||
/// </summary>
|
||||
public interface IXIdentityBaseReferencedProvider<TModel, TKey>
|
||||
{
|
||||
//
|
||||
#region Props ...
|
||||
/// <summary>
|
||||
/// Provider Identifier ...
|
||||
/// </summary>
|
||||
string Provider { get; }
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Identifier ...
|
||||
Task<int> LastIndex(TKey providedForId);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Referenced Actions ...
|
||||
/// <summary>
|
||||
/// Get Specified Indexed Reference for Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="forIndex"></param>
|
||||
/// <returns></returns>
|
||||
Task<TModel> GetReference(
|
||||
TKey providedForId,
|
||||
int forIndex = 0
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists References of Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TModel>> GetAllReferences(TKey providedForId);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve References of Specific Provided ID as Query ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<TModel>> QueryReferences(
|
||||
XQuery query,
|
||||
TKey providedForId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Reference a Model to Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="forIndex"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddReference(
|
||||
TModel model,
|
||||
TKey providedForId,
|
||||
int forIndex = 0,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Add Reference a Model to Specific XRefence<TKey> ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="reference"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddReference(
|
||||
TModel model,
|
||||
XReference<TKey> reference,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Reference a Model for Specific Provided ID ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="forIndex">if null, removes all</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReference(
|
||||
TModel model,
|
||||
TKey providedForId,
|
||||
int? forIndex = null,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Reference a Model for Specific XRefence<TKey> ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReference(
|
||||
TModel model,
|
||||
XReference<TKey> reference,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove All References to Specified Key ...
|
||||
/// </summary>
|
||||
/// <param name="providedForId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveReferences(
|
||||
TKey providedForId,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user