New Posts New Posts RSS Feed: Four Step sample question
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Four Step sample question

 Post Reply Post Reply
Author
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Topic: Four Step sample question
    Posted: 24-Jun-2009 at 4:19pm
Ben:

If you mean "why can't the result of the query be an IObservableCollection", I imagine the reason is that ObservableCollection is designed for UI purposes; whereas the query results may be needed for many different kinds of uses, for many of which a lighter-weight collection is entirely adequate.

You can, of course, refactor the foreach operation so you can do it a bit more succinctly.

>>
p.s. I would like to expand upon my question. If we are using a "Middle man" ObservableCollection (i.e. _employess or _orders) which are connected to the UI but have no connection to the result coming form the server, how is change on the UI going to make back to the server?
<<

Not sure which change you're talking about. All changes to the entities in the collection (Observable or otherwise) will get back to the server (and the backing store) via SaveChanges().
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: 19-Jun-2009 at 12:32pm
Hi;

In the Four step sample, as we load the Employees and we get the result back (same thing for orders), why do we need to iterate through the result list and add them to an IObservableCollection? Why can't the result be an IObservableCollection, so we can directly connect it to grid's ItemsSource?

Thanks!

p.s. I would like to expand upon my question. If we are using a "Middle man" ObservableCollection (i.e. _employess or _orders) which are connected to the UI but have no connection to the result coming form the server, how is change on the UI going to make back to the server?
I think that's why I'm asking why can't we connect the UI to result, so any changes to UI is recognized by EM.
Thanks!

Edited by BenHayat - 20-Jun-2009 at 7:52am
Best Regards!
..Ben

WPF & Silverlight Insider
http://www.MicroIntelligence.Com
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down