Enumeration support in OpenAccess?

6 posts, 0 answers
  1. Kendall Bennett
    Kendall Bennett avatar
    80 posts
    Member since:
    Feb 2010

    Posted 04 Jul 2011 Link to this post

    Is there any support for enumeration types layered on type of database integer values in OpenAccess? I have my own implementation I use for enumerations in our Entity Framework code I want to convert over, and I thought I read somewhere that OpenAccess supports enumerations natively, but I cannot seem to find anything in the documentation about that?
  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 05 Jul 2011 Link to this post

    Hi Kendall,

    You're right. OpenAccess natively supports enums. If you define an enum like:

    public enum CaseStatusEnum { New, Open, Closed }

    you can use this enum in your persistent class like

    public class Case
    {
       // Private field definition
       private CaseStatusEnum status;

      // Public getter / setter for the field goes here
    }

    and OpenAccess will map this default to and integer column in the table.

    Regards

    Henrik
  3. DevCraft banner
  4. Kendall Bennett
    Kendall Bennett avatar
    80 posts
    Member since:
    Feb 2010

    Posted 05 Jul 2011 Link to this post

    Excellent. How do I tell the designer where to find my enumeration types? Do I put them in the same namespace as the resulting entities, and then it will find it?
  5. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 06 Jul 2011 Link to this post

    I don't know how you structured solution, but if you have a separate project / class library for the persistent classes I suggest you put the enums there.
  6. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 08 Jul 2011 Link to this post

    Hi Kendall,

    Did you manage to solve it?

    Regards

    Henrik
  7. Kendall Bennett
    Kendall Bennett avatar
    80 posts
    Member since:
    Feb 2010

    Posted 08 Jul 2011 Link to this post

    I am stuck right now until the Q2 release is out, as I need some features and bug fixes that are coming in that release.
Back to Top
DevCraft banner