Add 增加扩展函数
This commit is contained in:
parent
cc23f8b00b
commit
04f8d9e15d
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using LFlow.Base.Interfaces;
|
||||
using Mapster;
|
||||
|
||||
namespace LFlow.Base.Utils;
|
||||
|
||||
public class Mapper
|
||||
public static class Mapper
|
||||
{
|
||||
/// <summary>
|
||||
/// 将一个对象映射到另一个对象
|
||||
|
|
@ -19,4 +19,12 @@ public class Mapper
|
|||
}
|
||||
return source.Adapt<T>();
|
||||
}
|
||||
public static T? MapTo<T>(this IDataModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
return model.Adapt<T>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue