New Posts New Posts RSS Feed: Where should EM become instantiated in SL?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Where should EM become instantiated in SL?

 Post Reply Post Reply
Author
BenHayat View Drop Down
Groupie
Groupie
Avatar

Joined: 06-Jan-2009
Location: Estero, FL USA
Posts: 86
Post Options Post Options   Quote BenHayat Quote  Post ReplyReply Direct Link To This Post Topic: Where should EM become instantiated in SL?
    Posted: 29-Jun-2009 at 5:58pm
Let's say, you're going to have a business application that uses one central EntityManager on the SL client side. Where is the proper place to create that EM? In App.CS or The MainPage.CS? What's the guideline that the EM can then be used throughout?
Or Should each page create a new instance and then let the GC removes it when the page is no longer is service?

Thanks!
Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com
Back to Top
BenHayat View Drop Down
Groupie
Groupie
Avatar

Joined: 06-Jan-2009
Location: Estero, FL USA
Posts: 86
Post Options Post Options   Quote BenHayat Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jul-2009 at 9:41am
It's been one week I've posted a simple question and no answer yet.
Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jul-2009 at 11:56am
Sorry about that, Ben.  Forum posts occasionally go "missing" in our tracking system.
 
We generally recommend using a Persistence layer in any non-trivial application.  In most if not all of our learning units you'll see an EntityManager instantiated within a page, but that's really a "demo-ware" type of approach and not recommended in a real application.   The Model Explorer and Prism Explorer samples both show a more robust application architecture and highlight techniques we recommend.
 
That said, you can certainly create an EntityManager for (and within) each page if that's what you want to do.  Using a "sandbox" approach like this is often useful for undo scenarios, where you want the ability to work in a separate area and commit or rollback as needed.  The checkpointing feature within the EntityManager can be useful in these cases too, but the separate EM approach can be more robust and performant. 
 
If you've found any patterns to be particularly effective with Silverlight applications (or Silverlight and DevForce), why not post them here to share with the community.
 
Back to Top
BenHayat View Drop Down
Groupie
Groupie
Avatar

Joined: 06-Jan-2009
Location: Estero, FL USA
Posts: 86
Post Options Post Options   Quote BenHayat Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jul-2009 at 12:28pm
Hi Kim; Thanks for the reply!

In most if not all of our learning units you'll see an EntityManager instantiated within a page, but that's really a "demo-ware" type of approach and not recommended in a real application.

The demos prompted me to post that question and wanted to get a clear line from you that, the demos aren't meant as P&P.

Using a "sandbox" approach like this is often useful for undo scenarios, where you want the ability to work in a separate area and commit or rollback as needed.  The checkpointing feature within the EntityManager can be useful in these cases too,]/quote]
This is an intresting thought!

[Quote]If you've found any patterns to be particularly effective with Silverlight applications (or Silverlight and DevForce), why not post them here to share with the community.

I haven't got there yet to establish a final pattern. At this point, there isn't a set way for a "Std" modularity in SL yet. Although there is Prism and MVVM, but seems like everyone is preaching about their own style.

That being said, how is this seperation of views and data binding is going to work with your upcoming DataSource and pager? The RIA ObjectDataSource seems to be very closely binded to UI controls. Hopefully when you guys release the DataSource, you will also document how it could be used directly or indirectly with UI controls!
Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jul-2009 at 1:43pm
The DataSource does break the recommended pattern, since it brings your data/persistence layer right into the UI (which is actually why I personally wouldn't use the DataSource in a real application, but no one cares what I think :)).  Anyway, the DataSource will be available to let you do simple declarative binding where appropriate, and leverage the EntityManager. 
 
We are not actually supplying a DataPager control, since the one in SL3 is sufficient.  What we will be providing is an implementation of IPagedCollectionView, which will allow you to use a DataPager and DataGrid with a DevForce EntityQuery and hide the mechanics of the underlying async queries.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jul-2009 at 1:51pm
Originally posted by BenHayat

The demos prompted me to post that question and wanted to get a clear line from you that, the demos aren't meant as P&P.
The learning units are usually intended to highlight a specific feature or solution to a problem, and are intentionally kept as simple as possible.  As our product matures we'll provide more full-featured samples and tutorials (as we do in our other products today), but right now we don't want to make it a prerequisite that a developer understand a dozen different things before they can understand and use the learning unit, especially since Silverlight itself has a steep enough learning curve.
Back to Top
BenHayat View Drop Down
Groupie
Groupie
Avatar

Joined: 06-Jan-2009
Location: Estero, FL USA
Posts: 86
Post Options Post Options   Quote BenHayat Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jul-2009 at 2:03pm
Think Kim for the info.

The DataSource is a great tool for prototyping and showing a concept. I thing between DS and SketchFlow, developers can come up with a full [prototyped] app very quickly!

but no one cares what I think :)).

Well, this is one place that Iwill put my foot down and say "You're Wrong" :-). I've heard more good things about Kim, that I can count...


Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com
Back to Top
zinovate View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2009
Posts: 9
Post Options Post Options   Quote zinovate Quote  Post ReplyReply Direct Link To This Post Posted: 09-Nov-2009 at 1:44pm
Kim,
Do you have an example or documentation using the PagedCollectionView with Devforce for Silverlight?
 
Ben
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 10-Nov-2009 at 8:20am
There's a sample in the Learning Resources in the 080_UserInterfaces\SilverlightApps\Samples folder called *PagedCollections which is an introduction to using the DevForce EntityQueryPagedCollectionView.
Back to Top
zinovate View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2009
Posts: 9
Post Options Post Options   Quote zinovate Quote  Post ReplyReply Direct Link To This Post Posted: 10-Nov-2009 at 8:33am
Thanks Kim,
I thought the learning units were not included in the last realse. When I tried to access the Learning units from the start menu, it came back as a missing shortcut.
It is pointing at ""C:\MyTutorials\Learning Resources\LearningResources.htm"" instead of "C:\Users\Public\Documents\DevForce\Learning Resources\", just  heads up.
I'm digging into the samples now.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 10-Nov-2009 at 9:31am
Re the folder location -- did you have any other issues with your installation, such as the project templates not installed or installed to the wrong location?  Are you running a 32-bit or 64-bit OS? 
Back to Top
zinovate View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Apr-2009
Posts: 9
Post Options Post Options   Quote zinovate Quote  Post ReplyReply Direct Link To This Post Posted: 18-Nov-2009 at 7:16am
Sorrry for the delay, 64 bit and all assets in the "Document' folder.
I was having other VS issues.
I reinstalled DevForce and the links are now correct. It must have been an upgrade anomoly.
 
Ben
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down