init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using Kreta.Ellenorzo.Domain.VN.Interfaces;
|
||||
|
||||
namespace Kreta.Ellenorzo.Domain.VN.Logic
|
||||
{
|
||||
/// <summary>
|
||||
/// Author: Kovács Kornél (DevKornél) Created On: 2019.07.
|
||||
/// </summary>
|
||||
public static class UidLogic
|
||||
{
|
||||
public static T GetUid<T>(string uidRaw, Converter<string[], T> uidConverter) where T : class, IReadonlyUidRaw
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(uidRaw))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string[] compositeKey = uidRaw.Split(Constant.UidInnerDelimiter);
|
||||
|
||||
T uid = uidConverter.Invoke(compositeKey);
|
||||
return uid;
|
||||
}
|
||||
|
||||
public static string[] GetCompositeKeyElements(string uidRaw) => string.IsNullOrWhiteSpace(uidRaw) ? null : uidRaw.Split(Constant.UidInnerDelimiter);
|
||||
|
||||
public static string Concat(params object[] compositeKeyElements)
|
||||
{
|
||||
for (int i = 0; i < compositeKeyElements.Length; i++)
|
||||
{
|
||||
if (compositeKeyElements[i] == null)
|
||||
{
|
||||
compositeKeyElements[i] = Constant.UidNullValue;
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(compositeKeyElements[i].ToString()))
|
||||
{
|
||||
compositeKeyElements[i] = Constant.UidNanValue;
|
||||
}
|
||||
}
|
||||
|
||||
return string.Join(Constant.UidInnerDelimiter.ToString(), compositeKeyElements);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue