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

How to use Enum datatype with Visual Designer?

2 Answers 102 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Skywalker
Top achievements
Rank 1
Skywalker asked on 22 Aug 2010, 12:33 AM
I have succesfully mapped enum types using "classic" OpenAccess before, but when I map a Metaproperty to an Enum type using the Designer version, I get a runtime error stating that:

Type is enhanced and registered, but not available from the database class meta data. This can be caused by a wrong connection id or configuration.
Parameter name: src
Actual value was MyWebsite.Models.Category

Where "Category" looks like this:

enum Category
{
   News = 1,
   Blog = 2,
   Forum = 3
}

So the code compiles, but something goes wrong at runtime.
Am I missing something?

2 Answers, 1 is accepted

Sort by
0
Skywalker
Top achievements
Rank 1
answered on 22 Aug 2010, 12:37 AM
I see now that the error has nothing to do with the enum, but with a Metaclass itself. I'm looking into it and will post back when I found out what went wrong.
0
Skywalker
Top achievements
Rank 1
answered on 22 Aug 2010, 02:04 AM
Ok, I was using the wrong datacontext. I'm using an OpenAccessContext and a DataScope in a single Webapplication using IOC. Because of an incorrect Castle Windsor configuration setting my application was using the DataScope instead of the OpenAccessContext object. I fixed this and now everything works great, including the enum typed property mapping.
Tags
Design Time (Visual Designer & Tools)
Asked by
Skywalker
Top achievements
Rank 1
Answers by
Skywalker
Top achievements
Rank 1
Share this question
or