Browse Source

Add DataTableToDictionary

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
9a62ce5b65
  1. 5
      Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs
  2. 1
      Src/Asp.Net/SqlSugar/Interface/IContextMethods.cs

5
Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs

@ -323,6 +323,11 @@ namespace SqlSugar
}
return this.DeserializeObject<List<T>>(this.SerializeObject(deserializeObject));
}
public Dictionary<string, object> DataTableToDictionary(DataTable table)
{
return table.Rows.Cast<DataRow>().ToDictionary(x => x[0].ToString(), x => x[1]);
}
#endregion
#region Cache

1
Src/Asp.Net/SqlSugar/Interface/IContextMethods.cs

@ -20,6 +20,7 @@ namespace SqlSugar
SqlSugarEngine CopyContext(bool isCopyEvents = false);
dynamic DataTableToDynamic(DataTable table);
List<T> DataTableToList<T>(DataTable table);
Dictionary<string, object> DataTableToDictionary(DataTable table);
ICacheService GetReflectionInoCacheInstance();
void RemoveCacheAll();
void RemoveCacheAll<T>();

Loading…
Cancel
Save