一切尽在代码中
Hashtable 风格
public Account GetByCustomIdAndAccountType(int customId, AccountType accountType)
{
var parms = new Hashtable()
{
{ "CustomId" , customId },
{ "AccountType" , (int)accountType }
}; return Mapper
.Instance()
.QueryForObject<Account>(Constants.Account.GetByCustomIdAndAccountType, parms);
}
匿名类型风格
public Account GetByCustomIdAndAccountType(int customerId, AccountType accountType)
{
var parms = new
{
customerId,
accountType
}; return Mapper
.Instance()
.QueryForObject<Account>(Constants.Account.GetByCustomIdAndAccountType, parms);
}
优点
- 减少重复,如:customerId 只出现一次。