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

If a table has a relationship to another table more than once, use the relationship name

14 Answers 151 Views
Feature Requests
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
AJ
Top achievements
Rank 2
AJ asked on 01 Jun 2012, 04:11 PM
For example,

I have an OrderNotes table that has a UserID and NotifyUserID column. Both link back to the Users table.

When I established the relationship, the name that was generated from SQL was FK_OrderNotes_Users and FK_OrderNotes_NotifyUsers. In SubSonic, this would have generated OrderNote.User and OrderNote.NotifyUser properties. However, in OpenAccess, I get a much less helpful "User" and "User1".

The temporary solution, from what I can tell, is going into the Visual Designer finding the relationship so I can determine if I need to rename the User or User1 properties and then actually rename the property name accordingly. In this case, I renamed User1 to NotifyUser.

Thanks,
Andrew

14 Answers, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 06 Jun 2012, 11:43 AM
Hello Andrew,

You are right, currently the name generator does not take into account the foreign key column/property name but only the name of the targeted class in the association. In case of multiple relations to the same class, a number is added to the the navigational property name.

We will consider your suggestion as a feature request and will add it to our backlog system, however I am not able to give you a time-frame when this functionality will be implemented.
Thank you for your feedback, it is highly appreciated.

Kind regards,
Alexander
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 18 Jun 2012, 02:47 PM
+10 on this...it's a painful way to generate the names in a LARGE model with lots of nav properties.  This is one of the reasons I need to maintain a separate unit test to do nothing but validate the model....because we do rename "User1" to whatever it should be in the first place.  So if I ever unmap\remap the class it becomes "User1" again.
0
Alexander
Telerik team
answered on 21 Jun 2012, 08:32 AM
Hello Steve,

We will raise the priority of this entry, hopefully we will be able to implement it for Q3 later this year.

Greetings,
Alexander
the Telerik team
OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 21 Jun 2012, 12:08 PM
I'm so happy on this :)  After everything put into Q2 2012, there isn't much more on my wishlist, but this is defiantly one :)
0
Murilo
Top achievements
Rank 1
answered on 22 Jul 2012, 09:24 PM
did someone find a less painful way to rename the navigation property names until the q3? Almost every table in our database has a relationship with users and it's been a hell to rename them :|
0
Murilo
Top achievements
Rank 1
answered on 23 Jul 2012, 01:33 AM
Hey, how can I send my project to this thread so people can download it from here?

I just developed a tool to help me out while there is nothing official from telerik. I will share it here because it might be of public interest.


The tool was developed based on 2012.2.607.1 version of orm, I dont know if there were changes in the template.

This tool can only be used if you are using Fluent Mapping

This tool WILL NOT alter anything in your model, it will only READ AS TEXT your model and fluent mappings to suggest you new names so you can rename them easily. See images for results

Instructions:

  1. Download the project
  2. Open the bin/debug folder
  3. Locate the app.config file
  4. Edit the paths with the paths to your orm files (.rlinq and FluentMetadataSource)
  5. Open PropertyNamesSavior.exe
  6. Optional - You can edit the paths now if you want
  7. Optional - You can put file filters on the third textbox, filter format: class1, class2, class3
  8. Click the button to generate name suggestions

Hope it help you guys like it helped me.

Let me know if someone has doubts or problems.

Feel free to edit the project to your own needs :-)

Project download:
http://www.4shared.com/rar/xkQ4YsIu/SaviorOfThePropertyNames.html 


0
AJ
Top achievements
Rank 2
answered on 23 Jul 2012, 12:38 PM
That looks very interesting and I would love to test it out, but the link provided says that the download is unavailable :(
0
Murilo
Top achievements
Rank 1
answered on 24 Jul 2012, 01:10 AM
Fixed the link, hope it helps

0
egoren
Top achievements
Rank 1
answered on 25 Oct 2012, 07:47 PM
We definitely need this feature.  

Or we need a way to select the relation used for a specific field of the entity instead of trying to figure out what line (relation) correspond to which field.  When you have multiple relations between entities it's just impossible to work with OpenAccess.

For example we have an entity that has 9 relations to the 'User' entity and may be 30 other relations to other entities.  Person also has 30 other relations to other entities so it is impossible to figure out what Person1...Person9 uses as a relation.   If the database foreign key was used it would be a lot easier for us.

I have joined a screenshot of what ous schema looks like in OpenAccess so you can see how much we suffer.

Thanks
0
Alexander
Telerik team
answered on 29 Oct 2012, 12:03 PM
Hi Eyal Goren,

This functionality couldn't make it for the Q3 version but you can expect it in the Q1 2013 release.
In the meantime (for one of the following service packs) we are going to add a context-menu command on the navigational members, which you will be able to use to edit the member's association.

Kind regards,
Alexander
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
0
AJ
Top achievements
Rank 2
answered on 29 Oct 2012, 12:23 PM
Alexander -- That sounds like a great first step in the right direction! Can't wait for that to be released.
0
egoren
Top achievements
Rank 1
answered on 02 Nov 2012, 03:13 PM
I totally agree with AJ this contextual menu would save us a LOT of time.

Can you let us know when it's available we will be planning an update as soon as it is available.

Thanks


0
Alexander
Telerik team
answered on 07 Nov 2012, 01:02 PM
Hi Eyal,

The new command will be available in the upcoming service pack, expected by the end of the month.
I will update this thread once the build is available.

Greetings,
Alexander
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
0
Alexander
Telerik team
answered on 13 Dec 2012, 07:37 AM
Hi guys,

The service pack (2012 Q3 SP1) is now available for download and contains the new context menu command for editing associations.

Regards,
Alexander
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
Feature Requests
Asked by
AJ
Top achievements
Rank 2
Answers by
Alexander
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Murilo
Top achievements
Rank 1
AJ
Top achievements
Rank 2
egoren
Top achievements
Rank 1
Share this question
or