New Posts New Posts RSS Feed: Nullable Enum not supported ?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Nullable Enum not supported ?

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

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Topic: Nullable Enum not supported ?
    Posted: 17-Jan-2013 at 11:45am
thank you, I can wait till the fix
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: 17-Jan-2013 at 11:20am
Hmm, this does look like a DevForce bug.  The nullable enums work from an EDMX-based model, but not in Code First.  I can't think of a workaround, but we'll get this fixed in the next release.
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 17-Jan-2013 at 11:08am
Here you go :


    [DataContract]
    public enum EtatEnum
    {
        [EnumMember]
        Waiting=1,
        [EnumMember]
        Validated = 2,
        [EnumMember]
        Sent = 3,
    }

    [DataContract(IsReference = true)]
    public class Purchase : PurchaseBase
    {
        ...

        [DataMember]
        public EtatEnum? Etat { get; set; }

        ...
    }

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: 17-Jan-2013 at 11:00am
DevForce does support nullable enum properties, so I don't know what might be going wrong.  Can you post a snippet showing your enum type and how the entity property is defined?
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 17-Jan-2013 at 12:46am
Hi,

With EntityFramework, I can use in code first a Nullable Enum Property. The migration works well.
With Devforce this same nullable Enum property raise an exception during the build :

C:\Dev\packages\IdeaBlade.DevForce.Aop.7.0.3\tools\IdeaBlade.DevForce.Common.targets(61,5): error : An error occurred during metadata generation and a metadata file could not be created.  Error: The value cannot be null.

if I change to a no nullable property it works.

Is this a limitation of DF or a bug ? Is there a workaround ?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down