Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to annotate two relations into another table
Message
De
15/06/2015 11:57:27
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Titre:
How to annotate two relations into another table
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01621011
Message ID:
01621011
Vues:
55
In a punch clock application, a given Day has two foreign keys into the Punches table: PunchId_In and PunchId_Out. How can you annotate this relationship so Entity Framework creates it as intended? Note: One or both of these foreign keys may be undefined (null).
public class Day
{
    public int DayID { get; set; }
    public int? PunchId_In { get; set; }
    public int? PunchId_Out { get; set; }
    public virtual Punch PunchIn { get; set; }
    public virtual Punch PunchOut { get; set; }
}

public class Punch
{
    public int PunchId { get; set; }
    public DateTime PunchDT { get; set; }
}
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform