This is a migrated thread and some comments may be shown as answers.

Using Enum definitions from another project

2 Answers 63 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chen-song
Top achievements
Rank 1
Chen-song asked on 02 Apr 2014, 05:37 PM
Hello,
currently I'm setting up enum mappings according to this: http://docs.telerik.com/data-access/developers-guide/data-access-domain-model/domain-class-mapping/developer-guide-domain-model-class-mapping-use-enums

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 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 07 Apr 2014, 07:27 AM
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.

Regards,
Boyan
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
Chen-song
Top achievements
Rank 1
answered on 11 Apr 2014, 03:26 PM
That worked really well.
Thank you very much!
Tags
Development (API, general questions)
Asked by
Chen-song
Top achievements
Rank 1
Answers by
Boyan
Telerik team
Chen-song
Top achievements
Rank 1
Share this question
or