My EF models are as follows:
public class ContentStatus { public ContentStatus() { this.Contents = new List<Content>(); } public int ContentStatusId { get; set; } public string Name { get; set; } public virtual ICollection<Content> Contents { get; set; } }
However, I also saw implementations similar to:
public class ContentStatus { public ContentStatus() { this.Contents = new HashSet<Content>(); } public int ContentStatusId { get; set; } public string Name { get; set; } public virtual ICollection<Content> Contents { get; set; } }
Here is the DDL for this object:
CREATE TABLE [dbo].[ContentStatus] ( [ContentStatusId] INT NOT NULL, [Name] NVARCHAR (50) NOT NULL, CONSTRAINT [PK_ContentStatus] PRIMARY KEY CLUSTERED ([ContentStatusId] ASC) );
Can someone tell me what I should use or even there is a difference, and when I will use List and when HashSet, if applicable.
thanks
Alan2
source share