我有一个返回List的ASMX文件。我正在使用EntityFramework和Database First模式。
我使用Visual Studio创建了EDMX。我有User,Stock和UserStockRelation表。 User类如下所示
public User()
{
this.UserStockRelation = new HashSet<UserStockRelation>();
}
public int Id { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public Nullable<bool> Active { get; set; }
public Nullable<System.DateTime> CreatedDate { get; set; }
public virtual ICollection<UserStockRelation> UserStockRelation { get; set; }
由于ICollection,它返回我在标题中提到的错误。如果我将ICollection转换为List,则会给出以下错误...
Cannot implicitly convert type System.Collections.Generic.HashSet<UserStockRelation> to System.Collections.Generic.List<UserStockRelation>
我该如何解决这个问题?