|
Entity framowork IDENTITY_INSERT
|
|||
---|---|---|---|
#18+
Добрый вечер, при добавлении объектов выскакивает ошибка: Cannot insert explicit value for identity column in table 'Sections' when IDENTITY_INSERT is set to OFF. Как можно с этим справиться программно, не используя настройки дизайнера? Кусок кода: context.Sections.Add(section); context.SaveChanges(); ... |
|||
:
Нравится:
Не нравится:
|
|||
18.07.2012, 23:07 |
|
Entity framowork IDENTITY_INSERT
|
|||
---|---|---|---|
#18+
Нашел такое решение проблемы. http://stackoverflow.com/questions/4669084/entity-framework-identity-insert-problem Приписал атрибут к свойству модели [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int IDSection { get; set; } ... |
|||
:
Нравится:
Не нравится:
|
|||
19.07.2012, 09:50 |
|
|
start [/forum/topic.php?fid=17&fpage=33&tid=1350295]: |
0ms |
get settings: |
10ms |
get forum list: |
14ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
39ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
34ms |
get tp. blocked users: |
2ms |
others: | 307ms |
total: | 427ms |
0 / 0 |