New Posts New Posts RSS Feed: DataForm Lookup Fields
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

DataForm Lookup Fields

 Post Reply Post Reply
Author
pholloway View Drop Down
Newbie
Newbie


Joined: 13-Sep-2009
Posts: 4
Post Options Post Options   Quote pholloway Quote  Post ReplyReply Direct Link To This Post Topic: DataForm Lookup Fields
    Posted: 29-Sep-2009 at 1:10pm

Greg, yeah, I'm definitely looking for "safest and easiest" at this point. Coming from a background of using stored procedures to do the heavy lifting, that model makes the most conceptual sense to me. Thanks!

Back to Top
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 Posted: 29-Sep-2009 at 12:54pm
Originally posted by pholloway


if you wanted to persist a changed Order record, is it a simple matter of calling Save against the entity manager -- in other words, is the FK relationship with Customer handled automagically, or do we need to do some extra stuff first?


That's all under your control. The safest -- and easiest -- thing to do is always to save all changes in your cache (orders, order line items, customers, products, everything) at the same time. That way, you don't accidentally save just part of a conceptual entity that spans more than one entity type (like an Order and its line items) and thus get data integrity issues.

On the other hand, there are use cases for saving only part of the cache, from a single entity on up, and you have the mechanisms to control exactly what gets submitted for a save. Under those circumstances, you have to take responsibility yourself to ensure that you don't create data integrity problems.
Back to Top
pholloway View Drop Down
Newbie
Newbie


Joined: 13-Sep-2009
Posts: 4
Post Options Post Options   Quote pholloway Quote  Post ReplyReply Direct Link To This Post Posted: 29-Sep-2009 at 10:43am
Thanks Greg, this is helpful. I see that you are loading Customer records into an ObservableCollection of Customers and binding that to the combobox. Now if you wanted to persist a changed Order record, is it a simple matter of calling Save against the entity manager -- in other words, is the FK relationship with Customer handled automagically, or do we need to do some extra stuff first?
Thanks again.
Back to Top
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 Posted: 25-Sep-2009 at 1:52pm
I wired up a ComboBox in the DataGrid in MainFormIntermediate in the solution for the FourSimpleSteps tutorial. It's bound to an Order's Customer, and displays the complete list of Customers to choose from.

The ComboBox there is just an ordinary one, used inside a DataEditingTemplate within the DataGrid column, so I believe the wiring would be similar used in a DataForm, or stand-alone.
Back to Top
pholloway View Drop Down
Newbie
Newbie


Joined: 13-Sep-2009
Posts: 4
Post Options Post Options   Quote pholloway Quote  Post ReplyReply Direct Link To This Post Posted: 18-Sep-2009 at 3:08pm
Not using a dataform --
 
What is the best quick way to make a Silverlight combo box do something actually useful - like display items from a lookup table, set the selected item to be the value associated with a customer record, and save the selected item's value back to the DB, for example?
 
Surely there is an easy way to do this?
 
Thanks.
 
 
Back to Top
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Posted: 25-Aug-2009 at 2:32am
@antalakas - Agreed. It will be in the next release of ME and PE (PrismExplorer) ... which will coincide with our DevForce 5.2.2 release coming up next week.
Back to Top
antalakas View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Jun-2007
Location: Greece
Posts: 28
Post Options Post Options   Quote antalakas Quote  Post ReplyReply Direct Link To This Post Posted: 25-Aug-2009 at 1:39am
Ward, thank you for your attention. I noticed this article last night after returning for vacation and i think it would be great to include DataContextProxy class in PRISM explorer.

A
Andreas Ntalakas
Back to Top
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Posted: 24-Aug-2009 at 2:52pm

It's coming. It's not a DevForce problem per se; more of a Silverlight WTF. But we'll be giving some guidance.

Meanwhile, for inspiration look at Explorer.FormViewModelHolder in ModelExplorer and PrismExplorer. It addresses the same problem of needing access to the ViewModel of an outer control when you're inside a nested control and something changed the DataContext on the way through those control layers.
 
Dan Wahlin had an improved approach to the one cited earlier; read about it here http://weblogs.asp.net/dwahlin/archive/2009/08/20/creating-a-silverlight-datacontext-proxy-to-simplify-data-binding-in-nested-controls.aspx which deals specifically with your ComboBox issue.
 
The next version of FormViewModelHolder will inherit from Dan's DataContextProxy, eliminating some of my hook up code.
Back to Top
bigfish View Drop Down
Newbie
Newbie


Joined: 20-Mar-2009
Location: Australia
Posts: 36
Post Options Post Options   Quote bigfish Quote  Post ReplyReply Direct Link To This Post Posted: 06-Aug-2009 at 5:58pm

I'm also looking for a clear example on how to do this please.

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: 08-Apr-2009 at 1:14pm
Thank you Sir!
Best Regards!
..Ben

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

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 08-Apr-2009 at 12:24pm

It's on our list now.  Thanks!

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-Apr-2009 at 7:13am
I'll add my vote to add some sample how to populate combobox at runtime with DevForce!
Thanks!
Best Regards!
..Ben

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

Joined: 25-Jun-2007
Location: Greece
Posts: 28
Post Options Post Options   Quote antalakas Quote  Post ReplyReply Direct Link To This Post Posted: 05-Apr-2009 at 4:31pm

Is it possible to use a Dataform with Devforce SL and create look-up comboboxes in the dataform?

I need a similar functionality like the one described here:
 
 
Thank you


Edited by antalakas - 05-Apr-2009 at 4:33pm
Andreas Ntalakas
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down