Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Please kindly help me with this Database Relationship issue for CodeFirst Approach

$
0
0

Dear All,

I have a business Application that I am developing. But right now, I have a system requirement. The core of the logic must be gotten right from the database. So I am abit confused on how to layer my database to cater for this functionality. Please I am open to your advice thanks alot.

Requirement.

The platform is a Sass application for small businesses. So it has 2 tables a table called  [Company] and Another table called   [Person]

Company Table represents the small businesses.

Person Table represents the Customer or Users  in the system. They  buy and communicate with this businesses

My Boss called me sometimes Last week requesting we make the system more marketing inclined were Users on the platform can refer businesses to the system.

Also users can also be Software developers who want to communicate with the platforms APIs and build for the Companys.

Based on this new requirement a company would have a relationship that can allow it get linked to 2 unique Users (Person Table)

  1. Would be a software developer on the network.
  2. Would be a marketer who is referring business to the network.

So the flow is, a marketer refers business to the network. A developer can implement apis for the company.

Let me paste my schemas so you give me your opinions if I am on the right track.

public class Company{

public int CompanyID{get;set;}

public string CompanyName{get;set;}

public string Phone{get;set;}

//Relationship would be below
public virtual Salesrep Salesrep{get;set;}

public virtual Developer Developer {get;set;}

}

public class Person{

public int PersonID{get;set;}

public string Firstname{get;set;}

public string Lastname{get;set;}

public string Phone{get;set;}

//Relationship would be below
public virtual Salesrep Salesrep{get;set;}

public virtual Developer Developer {get;set;}
}

public class Salesrep{

public int CompanyID{get;set;}

publlc virtual Company Company{get;set;}


public int PersonID{get;set;}

public virtual Person Person{get;set;}

}

public class Developer{

public int CompanyID{get;set;}

publlc virtual Company Company{get;set;}


public int PersonID{get;set;}

public virtual Person Person{get;set;}
}

Please kindly help me look at my schemas and give me insight if I am on the right track.

Thanks alot.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>