Linq

Query data with Golang and LINQ

Query langauges provide a set of features to querying, projecting and retrieving data (usually relational data). But how to introduces these standard, easily-learned patterns for querying data? In this article we will explore Go LINQ packages that bridges the gap between the world of objects and the world of data. LINQ For first time is introduced by Microsoft in their programming language C#. Its purpose is to bridge the gap between query languages such as SQL and programming languages.
Tags# , , ,

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# , , ,