How Do I Use Generic Variables for Customer Specific Data

Viewed 247

I've created a generic dll that holds commonly used variables. I have user defined fields that are place holders so we can hold customer specific data. This dll will be used in client specific apps.

How can I map these generic variables to the relevant sql table fields so that we can manipulate the custom database? I want to avoid writing custom queries.

Would an ORM like dapper be useful here?

Edit: Per danihp's reponse, I've started looking into Entity frame work. It looks promising. I'm inferring that using Fluent API I can make this dll portable into unique apps and pass a db object (instead of my class?) to do business logic.

Public Class Runs
    Private _RunMailPeices As Dictionary(Of String, MailPiece) = New Dictionary(Of String, MailPiece)
    Private _run As Integer    
    Private MailDate As DateTime
    Public Property RunMailPeices As Dictionary(Of String, MailPiece)
        Get
            RunMailPeices = _RunMailPeices
        End Get
        Set(value As Dictionary(Of String, MailPiece))
            _RunMailPeices = value
        End Set
    End Property

    Public Property run As Integer
        Get
            run = _run
        End Get
        Set(value As Integer)
            _run = value
        End Set
    End Property
End Class

And:

Public Class MailPiece

    Private _address1 As String = String.Empty
    Private _address2 As String = String.Empty
    Private _string1 As String = String.Empty
    Private _string2 As String = String.Empty
    Public Property Address1 As String
        Get
            Address1 = _address1
        End Get
        Set(value As String)
            _address1 = value
        End Set
    End Property

    Public Property Address2 As String
        Get
            Address2 = _address2
        End Get
        Set(value As String)
            _address2 = value
        End Set
    End Property
    Public Property String1 As String
        Get
            String1 = _string1
        End Get
        Set(value As String)
            _string1 = value
        End Set
    End Property

    Public Property String2 As String
        Get
            String2 = _string2
        End Get
        Set(value As String)
            _string2 = value
        End Set
    End Property
End Class
1 Answers
Related