c# - Entity Framework Self referencing 1 to 1 optional relationship -


So I have a table called contact and it can be of different types. And I want to have one-one, one-many or one-zero / one relationship in the table in itself. Is this possible? And if so, how?

For example, a contact may have a husband or wife, which is just another contact in the database. The contact can also be a type of organization, in this case there may be many relationships from one contact with other contacts.

This is what I am doing in the domain class. Public Relations (Public Relations) {Public Intinnate {Receive; Set;} ... public life spouses {receive; Set;} public virtual contact life partner {receives; Set;} public in OrgId {get; Set;} Public Virtual Contact Organization {get; Set;} Private Icicle & Lt; Contacts & gt; _individuals; Public virtual iconenging & lt; Contacts & gt; Set Individuals {{Returns _ Indies;} {_individuals = value; }} ...}}

I need to know how to properly map in embedded editing () in context. Any help would be appreciated.

There is something wrong here. If an organization is a husband of a contact and a contact then an organization has a husband?

I think that you need a Contactbase class:

  Public class contacts {int contactId icon & lt; Contacts & gt; Contact EntityTypeEnum EntityType}   

But on the second thought you might want to switch to a graph database because it looks like your description nodes and relationships.

Hope that helps!

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -