Search code examples
linqentity-frameworkentity-framework-4

How go get max value of a unique id column using LINQ


How can I write this in the simplest way using LINQ?

SELECT        MAX(Game_id) AS MaxValue
FROM          Dim_Game

Solution

  • Try context.Dim_Games.Max(g => g.Game_id);