public class Et_ErrorType
{
[Key]
public int Et_Id { get; set; }
public string Et_Type { get; set; }
public string Et_Instructions { get; set; }
public string Et_Note { get; set; }
}
1.把数据库返回的对象添加进数据字典
Dictionary dic = new Dictionary();
var ErrorType = _errorTypeService.ErrorTypeSelect();//数据库返回对象
int i = 0;
foreach (var et in ErrorType)
{
Et_ErrorType e_t = new Et_ErrorType();
e_t.Et_Id = et.Et_Id;
e_t.Et_Instructions = et.Et_Instructions;
e_t.Et_Note = et.Et_Note;
e_t.Et_Type = et.Et_Type;
dic.Add(i, e_t);
i++;
}