Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8849891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:46:17+00:00 2026-06-14T12:46:17+00:00

The association names sqlmetal generates have been the source of much frustration. Sometimes the

  • 0

The association names sqlmetal generates have been the source of much frustration. Sometimes the association is simply the column name with “Id” taken off the end, sometimes it generates an association name based on the foreign key constraint name.

I simply cannot figure out what steps it uses to generate these names, and a recent schema change has drastically altered the association names once again, so I’d like to get a handle on this.

I have two tables which reference each other in a sort of chain. Something like this:

class In
{
  int Id;
  EntityRef<Out> Yields;    // YieldsId => FK_Out_Source
  EntitySet<Out> In_Source; // FK_In_Source
}
class Out
{
  int Id;
  EntityRef<In> Yields;     // YieldsId => FK_In_Source
  EntitySet<In> Out_Source; // FK_Out_Source
}

These were the classes prior to the schema change, where there was an extra FK field between In and Out tables. After deleting that field, sqlmetal now generates this:

class In
{
  int Id;
  EntityRef<Out> Yields; // YieldsId => FK_Out_Source
  EntitySet<Out> Out;    // FK_In_Source
}
class Out
{
  int Id;
  EntityRef<In> In;         // YieldsId => FK_In_Source
  EntitySet<In> Out_Source; // FK_Out_Source
}

The previous classes were perfectly symmetrical as they should be, but now the generated classes are completely asymmetrical. Can anyone explain this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:46:18+00:00Added an answer on June 14, 2026 at 12:46 pm

    Since there seems to be no rhyme or reason to this, I created a command line tool that wraps sqlmetal and rewrites the association names. It’s included in my open source Sasa utilities framework, and is called sasametal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of teams with corresponding scores. $name[$i] contains the names while
I have a table with more than one Many2Many-Association to other tables. The names
I have a set of ids and names in an associative array and in
I have this association-list in Common Lisp: (defvar base-list (list (cons 'a 0) (cons
I have an association between a project and a task. A project has_many taks
I have a question concerning active record association, referring to this part of the
I have an asp.net web page used to search for company names in our
I'm maintaining a rails 2.1 application that has some unfortunate choices for column names.
What exactly means the association name direction (painted as a black triangle near the
I have permission from American Dental Association to deep link to videos on their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.