【发布时间】:2011-01-07 14:02:26
【问题描述】:
我有一些从上下文返回的数据。数据已被spCmsCategoriesReadHierarchy拉取。
我需要从上下文中获取所有数据并填充我的数据集。我的最终目标是使用 DataSet 对象填充 TreeView 控件。
有什么想法吗?感谢您的时间和耐心。
using (TestHierarchyEntities context = new TestHierarchyEntities())
{
int n = 0;
Int16 sl = 1;
ObjectParameter nn = new ObjectParameter("nn", typeof(int));
// Create a Data Set where adding the result of context
DataSet dataSet = new DataSet("myDataSet");
foreach (CmsCategory categories in context.spCmsCategoriesReadHierarchy(n,sl,nn))
{
}
}
【问题讨论】:
-
如果您需要数据集,为什么要使用 EF?好像是在浪费时间。
-
我认为你是对的吗!你知道如何使用上下文 (EF) 绑定 TreeView 吗?谢谢
标签: c# asp.net entity-framework