Using Enum definitions from another project

3 posts, 0 answers
  1. Chen-song
    Chen-song avatar
    4 posts
    Member since:
    Jan 2014

    Posted 02 Apr 2014 Link to this post

    currently I'm setting up enum mappings according to this:

    Is it possible to use enums defined in another project (for example a common defines library) for domain model mapping?  From what I can see, even if the data access project references that other library, the enums still can't be used since the generated classes (from Visual Designer) are not using that library's namespace.  Do I need to do custom code generation for this, or is there a setting?

    Thank you for any information.
  2. Boyan
    Boyan avatar
    100 posts

    Posted 07 Apr 2014 Link to this post

    Hi Chen-song,

    Yes, it is possible to use enumerations defined in another project. While modifying the code generation templates should work I would like to suggest a different approach. Once the Telerik Data Access project reference the library that contains the enumeration please change the type of the property (as suggested in the article) from int to {namespace}.{enumeration} (for example StatusesNS.OrderStatus​ as opposed to just OrderStatus​). Once the .rlinq file is saved it will cause the code to be regenerated and you will notice that the correct using statement is added.

    Should you have any further questions do not hesitate to contact us back.

    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
  3. DevCraft banner
  4. Chen-song
    Chen-song avatar
    4 posts
    Member since:
    Jan 2014

    Posted 11 Apr 2014 Link to this post

    That worked really well.
    Thank you very much!
Back to Top