Clean up, add DataRow Extension
This commit is contained in:
@@ -7,8 +7,8 @@ Imports MultiTool.Shared.Documents.DocumentRow
|
||||
|
||||
Public Class Mapper
|
||||
Private MapperConfig As MapperConfiguration
|
||||
Private LogConfig As LogConfig
|
||||
Private Logger As Logger
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
Private ReadOnly Logger As Logger
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig)
|
||||
LogConfig = pLogConfig
|
||||
@@ -31,7 +31,7 @@ Public Class Mapper
|
||||
Public Class MappingProfile(Of T)
|
||||
Inherits Profile
|
||||
|
||||
Private LogConfig As LogConfig
|
||||
Private ReadOnly LogConfig As LogConfig
|
||||
|
||||
Public Overrides ReadOnly Property ProfileName As String
|
||||
Get
|
||||
@@ -48,15 +48,13 @@ Public Class Mapper
|
||||
Private Class ReportTypeConverter(Of TDestination)
|
||||
Implements ITypeConverter(Of Dictionary(Of String, FieldValue), TDestination)
|
||||
|
||||
Private PropertyMap As Dictionary(Of String, String)
|
||||
Private KeyWithSubkey As New Regex("(?<Key>[\w\s-]+)(?:\[(?<Subkey>[\w]+)\])?")
|
||||
Private ReadOnly PropertyMap As Dictionary(Of String, String)
|
||||
Private ReadOnly KeyWithSubkey As New Regex("(?<Key>[\w\s-]+)(?:\[(?<Subkey>[\w]+)\])?")
|
||||
|
||||
Private LogConfig As LogConfig
|
||||
Private Logger As Logger
|
||||
Private ReadOnly Logger As Logger
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pPropertyMap As Dictionary(Of String, String))
|
||||
MyBase.New()
|
||||
LogConfig = pLogConfig
|
||||
Logger = pLogConfig.GetLogger()
|
||||
PropertyMap = pPropertyMap
|
||||
End Sub
|
||||
@@ -94,7 +92,7 @@ Public Class Mapper
|
||||
|
||||
' Set the property if it exists
|
||||
If oProperty IsNot Nothing Then
|
||||
Dim oValue = GetFieldValue(oFieldValue, oSourceKey, oSourceSubkey)
|
||||
Dim oValue = GetFieldValue(oFieldValue, oSourceSubkey)
|
||||
Logger.Info("Transferring value [{0}] from [{1}] -> [{2}]", oValue, oSourceKeyCombined, oDestinationKey)
|
||||
oProperty.SetValue(oResult, oValue)
|
||||
|
||||
@@ -113,11 +111,11 @@ Public Class Mapper
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function GetFieldValue(pValue As FieldValue, pKey As String, pSubKey As String) As String
|
||||
If pSubKey = "Original" Then
|
||||
Private Function GetFieldValue(pValue As FieldValue, pKey As String) As String
|
||||
If pKey = "Original" Then
|
||||
Return pValue.Original
|
||||
|
||||
ElseIf pSubKey = "External" Then
|
||||
ElseIf pKey = "External" Then
|
||||
Return pValue.External
|
||||
|
||||
Else
|
||||
|
||||
Reference in New Issue
Block a user