Object relation mapping with GORM

What is object-relation mapping (ORM, O/RM, and O/R mapping)? Object-relational mapping in computer science is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language. source: Wikipedia What is GORM? GORM is object-relation package for Go. It supports the following databases: FoundationDB PostgreSQL MySQL SQLite Installation It is easy to install by invoking go get command:

LINQ to SQL: Create generic method to load entity by primary key

Scenario We are implementing our data access layer based on LINQ TO SQL. In the specifications that were created by our software architect is required to have generic method that load from the data base any record into entity object by primary key. public class LINQGateway<TEntity> where TEntity : class { private IDbConnection _DbConnection; public LINQGateway(IDbConnection connection) { this._DbConnection = connection; } public TEntity GetEntityByPrimaryKey(object pkKey, params object[] pkKeys) { // TO DO } } Problem Every table has different primary key (count, name and data type of the primary key columns).
Tags# , , ,