This is a migrated thread and some comments may be shown as answers.

Enumeration support in OpenAccess?

5 Answers 146 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kendall Bennett
Top achievements
Rank 2
Kendall Bennett asked on 04 Jul 2011, 08:52 PM
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?

5 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 05 Jul 2011, 06:06 AM
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
0
Kendall Bennett
Top achievements
Rank 2
answered on 05 Jul 2011, 06:06 PM
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?
0
IT-Als
Top achievements
Rank 1
answered on 06 Jul 2011, 07:29 AM
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.
0
IT-Als
Top achievements
Rank 1
answered on 08 Jul 2011, 06:22 AM
Hi Kendall,

Did you manage to solve it?

Regards

Henrik
0
Kendall Bennett
Top achievements
Rank 2
answered on 08 Jul 2011, 06:57 PM
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.
Tags
General Discussions
Asked by
Kendall Bennett
Top achievements
Rank 2
Answers by
IT-Als
Top achievements
Rank 1
Kendall Bennett
Top achievements
Rank 2
Share this question
or