2012-01-07 7 views
0

Я новичок в ASP.NET MVC, и я хотел бы создать пользовательский тип данных из свойства на одном из моих классов. Я знаю, что это возможно, но, к сожалению, мне не хватает знаний, чтобы знать, что не так с моим кодом.ASP.NET MVC - Пользовательский тип данных с использованием enum

Я получаю следующее сообщение об ошибке:

"Schema specified is not valid. Errors: 
The relationship 'GarethLewisWeb.Models.Photo_Set' was not loaded because the type 
'GarethLewisWeb.Models.Photo' is not available. 
The following information may be useful in resolving the previous error: 
The property 'Orientation' on the type 'GarethLewisWeb.Models.Photo' has a property 
type of 'GarethLewisWeb.Models.Photo+Orientations' which cannot be mapped to a 
PrimitiveType." 

Вот код для моего класса Photo.cs который я думаю, что вызывает проблему.

public class Photo 
{ 
    public int PhotoID { get; set; } 
    public int PhotoOrder { get; set; } 
    public string Title { get; set; } 
    public string Description { get; set; } 
    public string FileLocation { get; set; } 
    public Orientations Orientation { get; set; } 
    public int Height { get; set; } 
    public int Width { get; set; } 
    public int Rating { get; set; } 
    public bool FeaturedPhoto { get; set; } 

    public enum Orientations 
    { 
     Square = 0, 
     Landscape = 1, 
     Portrait = 2 
    } 

    public virtual Set Set { get; set; } 
    public virtual PhotoExif PhotoExif { get; set; } 
} 

Любая помощь, озвученная! Благодарю.

ответ

Смежные вопросы