asp.net - ForeignKey not being recognised in VS2012 RC -
after lot of yesterday, came against known error in asp.net4 beta - upgraded vs2012 rc express (4.5), , vs reporting 2 errors in model, ok previously:
"the type or namespace name 'foreignkeyattribute' not found (are missing using directive or assembly reference?)"
"the type or namespace name 'foreignkey' not found (are missing using directive or assembly reference?)"
using system; using system.collections.generic; using system.linq; using system.web; using system.componentmodel.dataannotations; using system.data.entity.modelconfiguration.conventions; using system.data.entity; namespace mvcapplication6.models { public class tblrental { [key()] public int rental_id { get; set; } public int room_id { get; set; } public datetime check_in { get; set; } public datetime check_out { get; set; } public decimal room_cost { get; set; } public long customer_ref { get; set; } [foreignkey("customer_ref")] public virtual tblcustomerbooking customer { get; set; } } public class tblcustomerbooking { [key()] public long customer_id { get; set; } public string customer_name { get; set; } public string customer_email { get; set; } public virtual icollection<tblrental> rentals { get; set; } }
does know if foreignkey reference has been changed?
thanks help,
mark
i figured out needed add:
using system.componentmodel.dataannotations.schema;
i didn't need move before, assume foreignkey has been moved under schema namespace.
hope helps else,
thanks, mark
Comments
Post a Comment