【发布时间】:2012-10-25 00:37:13
【问题描述】:
我已经创建了这样的简单 POCO 类:
public class Entity
{
public int Id { get; set; }
public bool IsActive { get; set; }
}
这是我的 EF DbContext:
public class SampleContext:DbContext
{
public DbSet<Entity> Entities { get; set; }
}
我这样定义示例逻辑层:
public class EntityTask : IEntityTask
{
#region Implementation of IEntityTask
public IEnumerable<Entity> GetAll()
{
var contex = new SampleContext();
return contex.Entities.ToList();
}
#endregion
}
public interface IEntityTask
{
IEnumerable<Entity> GetAll();
}
这是在服务器项目中定义的 DomainService 类:
[EnableClientAccess()]
public class CrudService : DomainService
{
private readonly IEntityTask _entityTask;
public CrudService(IEntityTask entityTask)
{
_entityTask = entityTask;
}
public IQueryable<Entity> GetAll ()
{
return _entityTask.GetAll().AsQueryable();
}
}
完成这些步骤后,我不知道如何在 silverlight 项目中将数据绑定到 DataGrid。 我检查了网络上的许多链接,但其中许多使用向导将数据绑定到数据网格。 如何将实体绑定到 DataGrid ?
【问题讨论】:
标签: silverlight entity-framework data-binding ef-code-first wcf-ria-services