How to use Enum datatype with Visual Designer?

3 posts, 0 answers
  1. Skywalker
    Skywalker avatar
    67 posts
    Member since:
    Sep 2007

    Posted 21 Aug 2010 Link to this post

    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. Skywalker
    Skywalker avatar
    67 posts
    Member since:
    Sep 2007

    Posted 21 Aug 2010 Link to this post

    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.
  3. DevCraft banner
  4. Skywalker
    Skywalker avatar
    67 posts
    Member since:
    Sep 2007

    Posted 21 Aug 2010 Link to this post

    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.
Back to Top