close

這是小技巧,簡單來說就是懶, 一行幹掉省去還要去跑foreach 

最後效能調教的時候這都會是一些小細節

可以一次解決的就直接解決掉,

這個範例是SP, 當然要跟DBA合作很密切

不然這段是有點危險的.

 

1
2
3
4
5
6
7
8
 Dictionary<string, string> result = null;
 
 using (var conn = ConnectionFactory.CreateConnection(connect01))
 {
      result = conn.Query("GetReference", inputData, commandType: CommandType.StoredProcedure) 
        .ToDictionary(m => (string)m.Key, m => (string)m.Value);
 
 }
arrow
arrow
    文章標籤
    C# Dapper
    全站熱搜

    baechang 發表在 痞客邦 留言(0) 人氣()