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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:16:53+00:00 2026-06-12T07:16:53+00:00

I have 2 classes at the moment. The first is an asset, the second

  • 0

I have 2 classes at the moment. The first is an asset, the second is services associated with that asset. The Asset table in SQL Server has a PK over both ID and workflow_id.

public class Asset
{
    public int ID { get; set; }
    public int workflow_id { get; set; }

    public string name { get; set; }
}

The second table is services which has a PK over the 3 columns, the service ID, workflow_id and the asset_id the service is tied too.

public class Services
{
    public int ID { get; set; }
    public int workflow_id { get; set; }
    public int asset_id { get; set; }

    public string service_description { get; set; }
}

Example Data: Asset with ID#10 in workflow_id#27 matches all the Services with asset_id#10 in workflow_id#27.

How can I map these two together with the multi-column PKs?

  • 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-12T07:16:54+00:00Added an answer on June 12, 2026 at 7:16 am

    Annotate the columns that you want to be PK’s. In your example for the first model you would have:

        [Key, System.ComponentModel.DataAnnotations.Schema.Column(Order = 0)]
        public int ID { get; set; }
    
    
        [Key, System.ComponentModel.DataAnnotations.Schema.Column(Order = 1)]
        public int workflow_id { get; set; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have classes that are needed in both my web service and my server.
I have two questions. 1: At the moment I have two model classes that
Ok, so say I have got a table that looks like this: <table class=first-table
I have classes A, B and C. A has members B and C. C
I have classes that are named exactly the same across different plug-ins that I
I have been writing a small java application (my first!), that does only a
I have the following classes in an Entity Framework 4.3 Code-First Model for MVC3:
I have many classes in GWT that represents graphical widgets . They are packaged
I'm currently writing a filter for a selectable, I have some table cells that
I have quite a bit of code that I find myself using over and

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.