New Posts New Posts RSS Feed: Verification for FK Key property
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Verification for FK Key property

 Post Reply Post Reply
Author
katit View Drop Down
Senior Member
Senior Member


Joined: 09-Sep-2011
Posts: 146
Post Options Post Options   Quote katit Quote  Post ReplyReply Direct Link To This Post Topic: Verification for FK Key property
    Posted: 13-Jan-2012 at 1:35pm
I have Customer object and it's got TimeZoneKey property which is FK
 
When I bind TimeZone on customer screen - it looks like this:
 

<

ComboBox ItemsSource="{Binding TimeZones}" SelectedValue="{Binding CurrentItem.TimeZoneKey, Mode=TwoWay}" Grid.Column="1" Grid.Row="5" Margin="1" SelectedValuePath="TimeZoneKey" DisplayMemberPath="DisplayName" TabIndex="5">

</ComboBox>

 

Where I have issue is that verifier doesn't work. RequiredValueValidator is there, but problem is that if TimeZone not selected from dropdown - Key stays "0", not null and it's fine by verifier.
 
Just looking for best way to handle such scenario.
 
1. Default time zone to something?
2. Add another verifier and check to make sure Key>0 ?
3. Somehow stop Key default to 0?
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 17-Jan-2012 at 4:54pm
Hi katit,

I'd say that this depends on your business context. If the integer 0 will never be allowed as an id, then option 2 is okay. If 0 is a valid id number, then I'd implement a default negative value.

Another option is to implement your own null entity. Please see below links for more info.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down