1

I have a lot of enumerations as properties in my codefluent model. Codefluent uses an int as datatype to store this. In all cases a TinyInt would suffice. I can set the datatype to int16. How can i reduce it even further to set it to TinyInt.

PS Maybe setting it to INT16 by default would be better for enums.

Peter de Bruijn
  • 792
  • 6
  • 22

1 Answers1

1

The attribute enumTypeName allows to define the underlying CLR full type name. The DbType is inferred from the CLR type name. If you set System.Int16, the DbType will also be Int16:

<cf:enumeration name="Gender" enumTypeName="System.Int16">
  <cf:enumerationValue name="Unspecified" />
  <cf:enumerationValue name="Male" />
  <cf:enumerationValue name="Female" />
</cf:enumeration>

You can set the value of this attribute in the graphical interface:

enumTypeName

meziantou
  • 20,589
  • 7
  • 64
  • 83
  • Thanks, but my question was how to set it to TinyInt, that is even smaller than small int (int16) – Peter de Bruijn Apr 20 '16 at 18:30
  • Use `System.Byte` instead of `System.Int16` – meziantou Apr 20 '16 at 18:43
  • Thanks! Works like a charm!! However, I found a bug as well. If you mistype or mispaste the Underlying Type Name an error is shown in the property field. You can't get rid of this error. Only by closing Visual Studio without saving the model you can try again. – Peter de Bruijn Apr 21 '16 at 07:33