How to use shared variables for customer-specific data

I created a generic dll that contains commonly used variables. I have custom fields that are owners of places, so we can store customer-specific data. This DLL will be used in client applications.

How to match these common variables with the corresponding fields of the sql table so that we can manipulate the user database? I want to avoid writing custom queries.

Would ORM be useful, like dapper?

Edit: In response to danihp, I began to learn how the Entity frame works. It looks promising. I assume that using the Fluent API, I can turn this dll-portable into unique applications and pass a db object (instead of my class?) To conduct 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 
+7
sql orm entity-framework
source share
1 answer

You are looking for an entity infrastructure . You can easily map your classes to tables. You only have 2 classes connected between them. It is so easy to map these classes to tables with an entity. Then you will avoid writing queries, just a LINQ expression and navigation, although tables with navigation properties.

Entity Framework (EF) is an object-relational mapper that allows .NET developers to work with relational data using domain-specific objects. This eliminates the need for most data access codes, which developers typically need to write.

Typically, a data access layer is created. " Entity Framework - Microsoft Recommended Data Access Technology for New Applications "

Your code seems to be easily handled by EF, but if not, you can write new classes to easily save your custom classes.

You can learn from the EF VB.NET code example in the Entity Framework Fluent API with VB.NET

+5
source share

All Articles