/************************************************************************************************************
* file : MapperBridgeAbstract.cs
* author : cbg
* function:
* history : 2022-02-20
************************************************************************************************************/
using RG3.PF.Abstractions.Entity;
using RG3.PF.Abstractions.Enums;
using System;
using System.Threading.Tasks;
namespace RG3.PF.Abstractions.Interfaces
{
/// <summary>
///最终使用的mapper工具 缓存 key CacheKey
/// </summary>
public abstract class MapperBridgeAbstract
{
/// <summary>
/// 合并 mapper 文件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> MergeMapper<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
/// 合并 bridge 文件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> MergeBridge<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
#region 把mapper 和 bridge 生成到 位置
/// <summary>
/// 把mapper 和 bridge 生成到 位置
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <param name="mapperCenterType"></param>
/// <returns></returns>
public virtual async Task<T> Build<T>(PFGlobalParameter pf, MapperCenterType mapperCenterType)
{
T result = default(T);
switch (mapperCenterType)
{
case MapperCenterType.File:
result = await BuildFile<T>(pf);
break;
case MapperCenterType.SqlLite:
result = await BuildSqlLite<T>(pf);
break;
case MapperCenterType.MySql:
result = await BuildMySql<T>(pf);
break;
case MapperCenterType.MongoDb:
result = await BuildMongoDb<T>(pf);
break;
case MapperCenterType.Es:
result = await BuildEs<T>(pf);
break;
case MapperCenterType.Apollo:
result = await BuildApollo<T>(pf);
break;
case MapperCenterType.AgileConfig:
result = await BuildAgileConfig<T>(pf);
break;
case MapperCenterType.Nacos:
result = await BuildNacos<T>(pf);
break;
case MapperCenterType.Customer:
result = await BuildCustomer<T>(pf);
break;
default:
break;
}
return result;
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildFile<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildSqlLite<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildMySql<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildNacos<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildMongoDb<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildApollo<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildAgileConfig<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildEs<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> BuildCustomer<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
#endregion 把mapper 和 bridge 生成到 位置
#region 把mapper 和 bridge 生成到 位置
/// <summary>
/// 把mapper 和 bridge 生成到 位置
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <param name="mapperCenterType"></param>
/// <returns></returns>
public virtual async Task<T> Get<T>(PFGlobalParameter pf, MapperCenterType mapperCenterType)
{
T result = default(T);
switch (mapperCenterType)
{
case MapperCenterType.File:
result = await GetFile<T>(pf);
break;
case MapperCenterType.SqlLite:
result = await GetSqlLite<T>(pf);
break;
case MapperCenterType.MySql:
result = await GetMySql<T>(pf);
break;
case MapperCenterType.MongoDb:
result = await GetMongoDb<T>(pf);
break;
case MapperCenterType.Es:
result = await GetEs<T>(pf);
break;
case MapperCenterType.Apollo:
result = await GetApollo<T>(pf);
break;
case MapperCenterType.AgileConfig:
result = await GetAgileConfig<T>(pf);
break;
case MapperCenterType.Nacos:
result = await GetNacos<T>(pf);
break;
case MapperCenterType.Customer:
result = await GetCustomer<T>(pf);
break;
default:
break;
}
return result;
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetFile<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetSqlLite<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetMySql<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetNacos<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetMongoDb<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetApollo<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetAgileConfig<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetEs<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="pf"></param>
/// <returns></returns>
public virtual Task<T> GetCustomer<T>(PFGlobalParameter pf)
{
return default(Task<T>);
}
#endregion 把mapper 和 bridge 生成到 位置
}
}
文档更新时间: 2022-02-22 12:13 作者:admin