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

Relationship between 2 classes

$
0
0

Hi

  I have 2 classes . How i can create CountryId as Foreign Key in States Class

public class Country
    {
        [Key]
        public int CountryId { get; set; }
        public string CountryName { get; set; }
    }

    public class State
    {

        [Key]
        public int StateId { get; set; }
        public string StateName { get; set; }
        public int CountryId { get; set; }
    }

Thanks


Viewing all articles
Browse latest Browse all 1698

Trending Articles