This question is locked. New answers and comments are not allowed.
I wish to reference other persistent objects both by value and by Id. Yet the reverse-mapping wizard keeps undoing my changes in the app.config file. I will try to explain what I mean below:
In my current project, I make all DB changes directly to my database using my own database administration tools. Then, I use the reverse-engineering wizard to create my persistent classes. My database has several foreign-key references. For example, I have an OrderStatus table. My Order table references the OrderStatus table via an OrderStatusId field. In this case, the reverse-mapping wizard will output something along the lines of:
| [Telerik.OpenAccess.Persistent] |
| public partial class OrderStatus |
| { |
| private int id; |
| [Telerik.OpenAccess.FieldAlias("id")] |
| public int Id |
| { |
| get { return id; } |
| set { id = value; } |
| } |
| private string statusName; |
| [Telerik.OpenAccess.FieldAlias("statusName")] |
| public string StatusName |
| { |
| get { return statusName; } |
| set { statusName = value; } |
| } |
| } |
| [Telerik.OpenAccess.Persistent] |
| public partial class Order |
| { |
| private int id; |
| [Telerik.OpenAccess.FieldAlias("id")] |
| public int id |
| { |
| get { return id; } |
| set { id = value; } |
| } |
| private OrderStatus orderStatus; |
| [Telerik.OpenAccess.FieldAlias("orderStatus")] |
| public OrderStatus OrderStatus |
| { |
| get { return orderStatus; } |
| set { orderStatus = value; } |
| } |
| } |
Obviously, the reverse-mapping wizard places the private field entries in a code-behind file, so the output would consist of two files for each class.
Now, because I also wish to access the OrderStatusId field directly (rather than through the referenced object), I have added the following code to the main class declaration (not to the code-behind file):
| public partial class Order |
| { |
| ... |
| private int orderStatusId; |
| [Telerik.OpenAccess.FieldAlias("orderStatusId")] |
| public int OrderStatusId |
| { |
| get { return orderStatusId; } |
| set { orderStatusId = value; } |
| } |
| } |
Now, my class contains both an object reference and an Id reference to the OrderStatus. At this point I run the forward-mapping wizard and select the orderStatusId field. By default, the wizard has chosen "order_status_id" as the field name. However, my field name is "OrderStatusId," so I change it. At this point, I compile my project and everything works fine. Then, the next time I run the reverse-mapping wizard, OpenAccess has updated my app.config file and undone my change ("order_status_id" to "OrderStatusId"). It now has the field name listed as "order_status_id" again.
How can I cause either:
1. OpenAccess to automatically generate both an object AND an Id reference?
2. Stop undoing my changes to the app.config file?
Let me know if you require any further clarification.