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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:37:11+00:00 2026-05-19T22:37:11+00:00

I am a beginner in EF4 , and I am not able to understand

  • 0

I am a beginner in EF4 , and I am not able to understand something in .edmx file ,

Could anyone explain to me what is the benefit of AssociationSet ,I think Association element represents everything about the relationship between the tables , so why should I use AssociationSet .

Thanks,

  • 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-19T22:37:11+00:00Added an answer on May 19, 2026 at 10:37 pm

    The AssociationSet is a container for an association.

    Lets began from a simle case when we have a Contract and Address types. Its relationship could be described in xml like:

    <Association Name="FK_Address_Contact">
      <End Role="Contact" Type="SampleModel.Contact" Multiplicity="1">
        <OnDelete Action="Cascade" />
      </End>
      <End Role="Address" Type="SampleModel.Address" Multiplicity="*" />
      <ReferentialConstraint>
        <Principal Role="Contact">
          <PropertyRef Name="ContactID" />
        </Principal>
        <Dependent Role="Address">
          <PropertyRef Name="ContactID" />
        </Dependent>
      </ReferentialConstraint>
    </Association>
    

    As you can see here, one Contact can have many Addresses. We here describe that there exists a reference between two types. But how we can describe a case when in Contract type we can have, actually, two or more addresses. For example, WorkAddress and HomeAddress. Within Association we can describe only fact that two types have referenced each other, but within AssociationSet we can also describe that one type could use two equal references to other type.

    For such case we can define next xml:

    <EntityContainer Name="ContactsContainer" >
      <EntitySet Name="WorkContacts" EntityType="SampleModel.Contact" />
      <EntitySet Name="HomeContacts" EntityType="SampleModel.Contact" />
      <EntitySet Name="WorkAddresses" EntityType="SampleModel.Address" />
      <EntitySet Name="HomeAddresses" EntityType="SampleModel.Address" />
      <AssociationSet Name="ToWorkAddress" Association="SampleModel.FK_Address_Contact">
        <End Role="Contact" EntitySet="WorkContacts" />
        <End Role="Address" EntitySet="WorkAddresses" />
      </AssociationSet>
      <AssociationSet Name="ToHomeAddress" Association="SampleModel.FK_Address_Contact">
        <End Role="Contact" EntitySet="HomeContacts" />
        <End Role="Address" EntitySet="HomeAddresses" />
      </AssociationSet>
    </EntityContainer>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Absolute beginner question: I have a template file index.html that looks like this: ...
I'm not a beginner at C# but I really need to increase my understanding,
Beginner rails question: How does one return a file from a controller in rails?
Im beginner in android development. I ve just created a button in main.xml file
Beginner to assembly programming for x86. I have a simple asm file which I
Beginner android question. Ok, I've successfully written files. E.g. // get the file name
another beginner problem. Why isn't the following code with an asp.net page not working?
Beginner question here. In the .h file of an objective c class.. If you
VB beginner here. My For... Next Loop will not work and I cannot for
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later

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.