c# - Can't convert List to ICollection - Fluent API -
i've done before, don't know why throwing me errors.
these classes:
public class chatmodel { public int chatid { get; set; } public virtual list<chatmodel> messages { get; set; } } public class messagemodel { public int messageid { get; set; } public string issuer { get; set; } public string message { get; set; } public chatmodel chat { get; set; } } and i'm doing through fluent api:
modelbuilder.entity<chatmodel>() .hasmany<messagemodel>(c => c.messages) .withrequired(m => m.chat); the line that's giving me errors one:
.hasmany<messagemodel>(c => c.messages) it says:
error cs0266 cannot implicitly convert type 'system.collections.generic.list' 'system.collections.generic.icollection'. explicit conversion exists (are missing cast?)
but honestly, have absolutely no idea, i've done same thing other classes while creating other relationships. 1 giving me headache.
can tell me i'm doing wrong? in advance. :)
Comments
Post a Comment