Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function GetByID(Of T As Class)(ByVal pk As Object) As T
- Dim itemParam = Expression.Parameter(GetType(T), "item")
- Return GetTable(Of T).Single(
- Expression.Lambda(Of Func(Of T, Boolean))(
- Expression.Equal(
- Expression.Property(itemParam, GetPrimaryKeyName(Of T)),
- Expression.Constant(pk)
- ),
- New ParameterExpression() {itemParam}
- )
- )
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement