0

I'm using Entity Framework in my Silverlight 5.0 application with RIA Services.

I realized that to get the data from the client side, you have to get that data from an event when the async process is completed.

I was thinking if it's possible to create a generic repository where this one contains the DatabaseContext and get the data.

Someone can orient how to start this part.

Darf Zon
  • 6,268
  • 20
  • 90
  • 149

1 Answers1

0

Joel has a great tutorial here: http://joel.net/generic-iqueryable-repository-for-ado.net that explains the generic repository and how to implement one.

Edit: Asynchronus part: I was not sure (and still am not) whether you wanted the async part between client and server or for the actual repository to be async. I think it is the later so I will address it first. The easiest way is to give the repository a delegate that the repository will call as soon as it finishes executing its query.

public class MyRepository:IMyrepository
{
    public IEnumerable<MyReturnedObject> GetThoseObjects(Delegate ToCallWenDone,rest of parameters)
    {
         //get the data
         //invoke the delegate
    }
}

In case you wanted the call from the client to be async, take a look at this post: http://forums.silverlight.net/p/168335/385493.aspx

Hope this helps.

JTMon
  • 3,189
  • 22
  • 24
  • This is a good example for a generic repository, however, it does not show how to implement it asynchronously. – cadrell0 Sep 07 '12 at 20:00