1

I'm working with EntityFramework and Silverlight, and I'm dealing with this situation. When I try to load the data from a EntitySet, I have to get the data from a callback.

Now, I need to get the data inmediately, I mean wait until the process finished.

In the next code, the part which I'd like to wait the process is Objectives property. Or I don't know if I can convert the callback method into a IAsyncResult, or something like that.

public class EntityService : IEntityService
{
    public EntityService()
    {
        _entities = new DatabaseDomainContext();
    }

    private DatabaseDomainContext _entities;
    public DatabaseDomainContext Entities
    {
        get { return _entities; }
        set { _entities = value; }
    }

    private EntityList<Objective> _objectives;
    public ObservableCollection<Objective> Objectives
    {
        get
        {
            if (_objectives == null)
            {
                var loadOp = _entities.Load(_entities.GetObjectivesQuery()/*, Callback, true*/);
                _objectives = new EntityList<Objective>(_entities.Objectives, loadOp.Entities);
            }

            return _objectives;
        }
    }
}
4

1 回答 1

1

实施 INotifyPropertyChanged。当结果返回时,引发 NotifyPropertyChanged。

于 2012-09-25T05:32:02.820 回答