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

  • SEARCH
  • Home
  • 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 6165327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:08:40+00:00 2026-05-23T22:08:40+00:00

Sorry for long title, the question is rather simple: I have 2 classes, Player

  • 0

Sorry for long title, the question is rather simple:

I have 2 classes, Player and Role (they are activerecord table)

class Player
{
    ...Various fields...

    [BelongsTo("RoleId")]
    public Role Role {get;set;}
}

class Role
{
    ...Various fields...

    [Property]
    public string Name {get;set;}
}

A Player, can have only one role, but (for me), it doesn’t matter if Role has 0-1-2-many players, so I would like to omit HasMany attribute (my example is easy, but my database is much bigger than this). Role is behaving like a user-defined enum, is possible to do this? Which is the correct way?

Edit 1:
What if I have a similar situation but I need that a Role belogs only to one player (onetoone), but again I would like to omit the part from the “Role” class (so role doesn’t know anything about this association)

  • 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-05-23T22:08:41+00:00Added an answer on May 23, 2026 at 10:08 pm

    If you specify BelongsTo attribute and not HasMany attribute, what I want is already done, the Role doesn’t matter if has 0-1-2-many players.

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

Sidebar

Related Questions

Sorry for the long and self explanatory title, but UIScrollView has raised so many
This is more of a general question as I have found relatively little information
First of all, I'm sorry for a long explanation. I need to develop a
The body field of a form may contain long text, so the default String
i have implemented a tile based layer in my game, but after the first
Before you say, yeah this question can be duplicate; https://stackoverflow.com/questions/2912890/gridview-freeze-pane-solutions How to freeze GridView
I have two forms named 'mainForm' and 'addRslt'. The idea is when users click
I am trying to add an image into a document using WordML. I have
I hope someone can help as I'm at my wits end with this. What
I'm trying to learn objective-c by making a GUI application using Xcode 3. I'm

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.