This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
|
|
|
You can't do this, because it would break LightSpeed at runtime. LightSpeed requires the foreign key field to have the name of the association field plus "Id" -- that's how it locates the FK field. |
|
|
It would be useful if Backreference Id naming is a part of naming strategy in next following versions of LightSpeed. |
|
|
Could you explain what value you see in this? The foreign key is a private field; why is it important to customise its name? The wrapper property can be renamed by coding it manually (LightSpeed does the matching on field names, not property names), and for display purposes there is always DisplayNameAttribute. |
|
|
Of course it is low priority feature, but one may be necessary if a company has internal naming policy. |
|
|
For example in my company following private fields naming policy is accepted: private field name begins with "_" and letter in lower case ("_privateField") It is well known convention |
|
|
I'm sorry, some misunderstanding took place, my question about public property with followning comment (generated by LightSpeed): /// <summary>Gets or sets the ID for the <see cref="Backreference_Name" /> property.</summary>I can set custom for this property using "Backreference Id Custom Attributes" property. |
|
|
I can set custom attributes for this property using "Backreference Id Custom Attributes" property. |
|
|
"The wrapper property can be renamed by coding it manually " Yes. Here we are talking about public property of a foreign key identifier behind the private field of the foreign key identifier. Indeed, we do not need to give custom name to private field but for public property - you call it wrapper ??? So now, what you mean by saing "The wrapper property can be renamed by coding it manually ". Do we have to modify automaticaly generated DataUnitOfWork.cs file to change e.g. "StopId" to "Stop_Id", or do we have to create a partial class and add "Stop_Id" wrapper for automaticaly "StopId". What we would like is to have a property in a designer for a assosiatan named "Backreference Id Name" that would force you code generator to make public property to be what we need e.g. "Stop_Id" not "StopId" Waiting for a quick response we need it badly the project is crashing due to the issue. Our customers a angry and will beat us soon. We don't want to die. :) - SHUTKA |
|
|
You don't need to modify the generated file; you can create the renamed property in a partial class. Just select your association in the designer, go to the properties window and set Generation to FieldOnly. This will cause the code generator to emit only the private fields (the entity holder _stop, the FK field _stopId and the reverse association collection _things). You will now need to write the public API in the partial class files. A good way to get started with this is to copy the previously generated code, but the pattern is always like this: public int Stop_Id /* FK property, rename as you wish */ { public Stop WhatsStoppingMe /* Associated entity, rename as you wish */ { and in the Stop.cs partial: public EntityCollection<Thing> ThingsIAmStopping /* Child entity collection, rename as you wish */ { Note that setting Generation to FieldOnly suppresses *all* of these properties so you need to rewrite them all by hand; we don't provide the ability to suppress only the FK property. We'll look at supporting a way of overriding the property (not field) name in the designer but hopefully this will save you from beatings and death for the time being. |
|
|
OK, Clear. Thank you very much. But to be sure that "What we would like is to have a property in a designer for a assosiatan named "Backreference Id Name" that would force you code generator to make public property to be what we need e.g. "Stop_Id" not "StopId"" is handled some day. Just remind you to put this request to you customer request managment system for it to be included in some subsequent release or nightly build Once again, thanks a lot for your attention |
|
|
"What we would like is to have a property in a designer for a assosiatan named "Backreference Id Name" that would force you code generator to make public property to be what we need e.g. "Stop_Id" not "StopId""
+1 on this. I have a number of existing tables where the back reference id column is not named XxxxId. |
|
|
Hello Sean, It sounds like your issue is about mapping the column name in the database, not the name of the property in the object model. This is already handled -- just set the Backreference Id Column Name on the association. |
|
|
I have been having some issues around it, and setting the backreference id column has't worked. I'll do a separate post on it later once I have a better handle on the problem. Sean |
|