1

Я хочу использовать тип данных «TagLib.Tag» в своей сущности Song. Когда я пытаюсь включить миграции я получаю:не примитивные типы данных для моделирования?

One or more validation errors were detected during model generation: 

\tSystem.Data.Entity.Edm.EdmEntityType: : EntityType 'XmpNode' has no key defined. Define the key for this EntityType. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_Exif_Source' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_Exif_Target' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'XmpTag_NodeTree_Source' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_Xmp_Source' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_Xmp_Target' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_OtherTags_Source' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_OtherTags_Target' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_AllTags_Source' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: : The referenced EntitySet 'Tags' for End 'CombinedImageTag_AllTags_Target' could not be found in the containing EntityContainer. 
\tSystem.Data.Entity.Edm.EdmEntitySet: EntityType: EntitySet 'XmpNodes' is based on type 'XmpNode' that has no keys defined. 
\tSystem.Data.Entity.Edm.EdmEntitySet: EntityType: EntitySet 'Tags' is based on type 'Tag' that has no keys defined. 

Как я могу использовать внешние сложные типы данных в моей модели?

+0

Пожалуйста, добавьте Taglib.Tag детали класса –

ответ

0

Я вижу, что ошибка в классе объектов тега, которую вы не определили для этих свойств ключа.

Возможно, ваш код выглядит следующим образом:

public class Tag 
{ 
    public string TagName{get; set;} 
    // other fields 
} 

вы должны изменить его следующим образом:

public class Tag 
{ 
    [Key] 
    public int TagId{get; set;} 
    public string TagName{get; set;} 
    // other fields 
} 
Смежные вопросы