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 3422918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:17:51+00:00 2026-05-18T06:17:51+00:00

There seems to be hardly any examples out there so here goes: Here are

  • 0

There seems to be hardly any examples out there so here goes:

Here are my three structures but it doesn’t seem to create the tables properly and when I call the following line it says Id is not recognised:

IEnumerable<Permission> permissions = _data.Find<RolePermission>(x => x.Role.RoleKey == roleKey).Select(x => x.Permission);

RolePermission:

public class RolePermission
{

    [SubSonicPrimaryKey]
    public int RolePermissionId { get; set; }

    public int RoleId { get; set; }
    public int PermissionId { get; set; }

    //Foreign Key of Role
    public Role Role { get; set; }

    //Foreign key of Permission
    public Permission Permission { get; set; }

}

Permission:

public class Permission
    {

        [SubSonicPrimaryKey]
        public int Id { get; set; }
        [SubSonicLongString]

        public string PermissionKey { get; set; }
        [SubSonicLongString]
        public string PermissionDescription { get; set; }

    }

Role:

public class Role
    {

        [SubSonicPrimaryKey]
        public int Id { get; set; }

        [SubSonicLongString]
        public string RoleKey { get; set; }

        [SubSonicLongString]
        public string RoleDescription { get; set; }

    }
  • 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-18T06:17:51+00:00Added an answer on May 18, 2026 at 6:17 am

    I don’t know if this has been fixed in a current release but I remember a silly bug in subsonic’s primary key detection.

    • If your Object contains a property named Id subsonic assumes that is your primary key.
    • If not you have to tell subsonic with is your PK by decorating a property with the SubSonicPrimaryKey attribute (like you did).
    • If you have a property called Id and it is also decorated with the attribute (like your Role and Permission class) subsonic finds the property twice and does not check if they both equals. Then it throws an exception because it can’t reliably determine which one to take.

    Long story short, you should try:

    a) Remove the Attribute from your Id column

    b) Rename the property to RoleId or PermissionId (which would be more consistend because your RolePermission class has it’s PK called RolePermissionId)

    If that doesn’t help, please provide a stacktrace.

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

Sidebar

Related Questions

Here's the page in question: http://bit.ly/m5cyjx There's hardly any code or styling. It seems
There seems to be a similar question to this on here but with the
There seems to be three common approaches for mapping an application end user to
Is there any way of finding out if a domain is available in ActiveDirectory
There seems to be much about this, but everyone seems to want street level
There seems to be many questions WRT tool to generate diffs between xmls, but
Either my google searching has completely left me or there's hardly any documentation/tutorials for
There seems to be no good way to localize a WPF application. MSDN seems
There seems to be a lot of heated discussion on the net about the
There seems to be two major conventions for organizing project files and then many

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.