code_junkie

Normalizing EnumStringType in NHibernate

Nov 12th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public enum UploadMethod
  2. {
  3. Java, Silverlight, Gears, Flash
  4. }
  5.  
  6. class UploadMethodType : EnumStringType
  7. {
  8. public UploadMethodType() : base(typeof(UploadMethod), 255) { }
  9. }
  10.  
  11. public class Person
  12. {
  13. /* Bunch of non interesting properties... */
  14. public UploadMethod PreferredUploadMethod { get; set; }
  15. }
  16.  
  17. <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  18. <class name="Person" lazy="false" table="[dbo].[People]">
  19. <!-- Bunch of non interesting properties... -->
  20. <property name="PreferredUploadMethod" type="UploadMethodType" />
  21. </class>
  22. </hibernate-mapping>
Add Comment
Please, Sign In to add comment