UPDATE: Figured this one out! I was always using a fully-qualified type name on my enums- for this to work, you have to prepend the global:: prefix. Unqualified type names work fine, as long as the type is visible from the generated LINQ entity class namespace. I filed this as a bug...
-----
Has anyone successfully managed to use the Orcas Beta2 (sorry, VS2008) bits to do first-class enum mapping onto an int column? My Beta1 code is doing the "define another property that does the mapping from int->enum and back" trick, but I'd like to let the mapper do it for me now that it's supposedly supported. I've got my enum defined, but when I set the 'Type' field on the column properties in the O/R designer to the FQ name of the enum, I get the following error:
DBML1005: Mapping between DbType 'Int' and Type 'AnApp.AnEnum' in Column 'EnumDBColumn' of Type 'ATable' is not supported.
I know it's finding the type- I get a different error if I use a bogus type name. Grr. I'm hoping I'm just doing something dumb- I really want this to work!
Saturday, July 28, 2007
Subscribe to:
Post Comments (Atom)
9 comments:
Hi,
Did you end up filing a bug for this?
I did (https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=289435), but after fighting with the Connect moderator for a couple of rounds (and even giving them a sample app), I gave up. Some groups have really sharp moderators watching their Connect postings, some don't. I had a workaround, and too much work to do on my own product to keep fighting with them- I believe they "Closed, Not Reproduced" the issue. Ha!
Works for me, if I just set the enum's type name, instead of the FullName.
You missed the point- setting the non-namespace-qualified type name works fine if the enum is in the same namespace as the DataContext/Entity types. It breaks when the enum is in a different namespace.
Broken keyboard on this bug. Thank you.
This bug still exists in the release version of VS 2008. Thanks for posting a fix!
Thanks Matt for the fix, for me I haven't set a namespace for the DataContext/Entity types so it should be the same as my enum types. However, although it works most of the time intermittently I get this error and find I have to either restart visual studio or delete the linq class file and recreate. But your workaround solved the issue for me.
Thanks a lot for the fix mate. Wonder how you came up with "global::" prefix :)
Your nearly-two-year-old post has just saved my day: it appears that still today, in June 2009, we have same problem in Visual Studio 2008 SP1! Thanks for the workaround!
Post a Comment