Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. Mapping tinyint column to an enum - SOLVED

Mapping tinyint column to an enum - SOLVED

Scheduled Pinned Locked Moved LINQ
phpvisual-studiocomhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1

    Hi I am trying to map an enum to a tinyint column, eg:

    enum Foo : byte
    {
    Bar = 1,Baz = 2
    }

    But I keep on getting a DBML1005: Not supported error. From digging through the code in Reflector I can see that an Enum can indeed map to a tinyint, and it should produce a warning about possible dataloss. Any suggestions? Am I missing something here? [update] arg, it seems you must NOT use the full type name... :doh: [update]

    xacc.ide - now with IronScheme support
    IronScheme - 1.0 alpha 1 out now

    R 1 Reply Last reply
    0
    • L leppie

      Hi I am trying to map an enum to a tinyint column, eg:

      enum Foo : byte
      {
      Bar = 1,Baz = 2
      }

      But I keep on getting a DBML1005: Not supported error. From digging through the code in Reflector I can see that an Enum can indeed map to a tinyint, and it should produce a warning about possible dataloss. Any suggestions? Am I missing something here? [update] arg, it seems you must NOT use the full type name... :doh: [update]

      xacc.ide - now with IronScheme support
      IronScheme - 1.0 alpha 1 out now

      R Offline
      R Offline
      rwwilden
      wrote on last edited by
      #2

      Hi, I ran into the same problem but the way to fix it for me was to prefix the enum type name with global:: I ended up with the following dbml fragment:

      <Column Name="Foo" Type="**global::**MyNamespace.Foo" DbType="TinyInt NOT NULL" IsPrimaryKey="true" CanBeNull="false" />

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups