using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks;namespace Project.Entities {public class ShoppinglistLineitem { [Key, Column("Id"), DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { set; get; } [Required] public string ItemName { set; get; } public string Description { set; get; } [Required] public float Quantity { set; get; } [Required] public string Currency { set; get; } [ForeignKey("Id"), DatabaseGenerated(DatabaseGeneratedOption.None)] public ShoppingList ShoppingList { set; get; } [ForeignKey("ShoppingList")] public Guid shoppinglistId { get; set; } }}
Tuesday, 2 December 2014
Create Foreign key using Entity model for code first
Labels:
DotNet
Subscribe to:
Post Comments (Atom)









No comments:
Post a Comment