数据字典添加对象
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<int, Et_ErrorType> dic = new Dictionary<int, Et_ErrorType>();
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++;
}
浙公网安备 33010602011771号