visual studio 2010 - Why can't I use the Column data annotation with Entity Framework 5? -
i want use column
data annotation shown in sample code below compiler (and intellisense) not seem know particular data annotation. i'm using ef 5 in visual studio 2010. installed ef 5 using nuget. required
, maxlength
annotations working.
using system; using system.collections.generic; using system.componentmodel.dataannotations; namespace model { public class destination { public int destinationid { get; set; } [required] public string name { get; set; } public string country { get; set; } [maxlength(500)] public string description { get; set; } [column(typename="image")] public byte[] photo { get; set; } public list<lodging> lodgings { get; set; } } }
what missing?
column in:
using system.componentmodel.dataannotations.schema;
the following code:
using system.componentmodel.dataannotations.schema; using system.data.entity; namespace consoleapplication2 { public class mycontext : dbcontext { public idbset<entity> entities { get; set; } } public class entity { public int id { get; set; } [column(typename = "image")] public byte[] photo { get; set; } } }
produces:
Comments
Post a Comment