New Posts New Posts RSS Feed: Verification attributes on generated properties
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Verification attributes on generated properties

 Post Reply Post Reply
Author
JST View Drop Down
Newbie
Newbie


Joined: 16-Jun-2010
Location: Netherlands
Posts: 8
Post Options Post Options   Quote JST Quote  Post ReplyReply Direct Link To This Post Topic: Verification attributes on generated properties
    Posted: 25-Jun-2010 at 3:17am
Right, it gets generated on new model. To bad it can't be done when doing update. Oh well, I guess this will be an hour or two renaming properties and copying the right partial files again. It'll work out. Thanks.

Edited by JST - 25-Jun-2010 at 3:18am
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: 21-Jun-2010 at 8:50am
The generation of that attribute in the CSDL would be up to the Entity Framework. Try generating a fresh model against the same table(s) and see if it gets generated.
Back to Top
JST View Drop Down
Newbie
Newbie


Joined: 16-Jun-2010
Location: Netherlands
Posts: 8
Post Options Post Options   Quote JST Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jun-2010 at 1:06am
That seems indeed to be the problem. So, the logical next question is: How do I have this property autogenerated? I set one by hand, and indeed the attribute was there. So far so good. But now ...? Any inside information on this? 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: 18-Jun-2010 at 2:58pm
Also check the MaxLength attribute on the property in the CSDL. If for some reason the CSDL entities don’t have the MaxLength set for string properties, we won't generate the StringLengthVerifier.
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: 18-Jun-2010 at 2:00pm
I just tried it with 5.2.6 - made a brand new model with a couple of tables in NorthwindIB, generated the code, and the attributed verifiers are there as they should be. At first I didn't see them because I looked at the generated code associated with the EDMX instead of the IBEDMX. But I only did that because I spend most of my time in DevForce 2010 and there's *only* an EDMX in DF2010 solutions.

I just mention that on the off-chance you're also working with DF2010 and made the same mistake. But you're probably not as bone-headed as I am. 8-)
Back to Top
JST View Drop Down
Newbie
Newbie


Joined: 16-Jun-2010
Location: Netherlands
Posts: 8
Post Options Post Options   Quote JST Quote  Post ReplyReply Direct Link To This Post Posted: 17-Jun-2010 at 12:42am
I do. Also unchecked, checked again, tried .net attributes, switched back to Ideablade. All to no avail.
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: 16-Jun-2010 at 12:51pm
Do you have the Generate Validation Attributes checkbox checked on the Entity Model node in the Object Mapper when you generate? Also the associated "DevForce" RadioButton selected?
Back to Top
JST View Drop Down
Newbie
Newbie


Joined: 16-Jun-2010
Location: Netherlands
Posts: 8
Post Options Post Options   Quote JST Quote  Post ReplyReply Direct Link To This Post Posted: 16-Jun-2010 at 7:22am
Hi,
 
I'm using IB version 5.2.6.0. Now I would like to see stringlenght verifiers on my generated properties. But then never get generated. We're talking Silverlight here. Anything I can do or check?
 
When I manually add a verifier all goes well as expected. But going through a hundred+ entities to do this for all string properties isn't making me happy.
 
Any hints, tips, suggestions.
 
Thanks
 
Johan Storteboom
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down