My EF models look like this:
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 have also seen implementatins looking like this:
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 anyone tell me which I should use or even is there a difference and when would I use the List and when the HashSet if that applies.
Thanks