Let's suppose i've a class Auction
public class Auction {
[Key]
public int Id { get; set;}
public User Seller {get; set;}
public User Winner {get; set;}
}
and a class User
public class User {
[Key]
public string Username {get;set;}
public string Password {get; set;}
}
What can i do to make Seller and Winner as FK using ForeignKey attribute on Visual Studio?
Edit
I use the [key] attribute because i've got other tables in the db and their PK is not called id, so i use in every class the attribute [key] to use the same style.
And when i try to upload a Seller of an Auction by using an already existing user it says
The ForeignKeyAttribute on property 'Seller' on type 'Database.Auction' is not valid. The foreign key name 'User' was not found on the dependent type 'Database.Auction'. The Name value should be a comma separated list of foreign key property names.
It was for this reason i wanted to specify the FK