|
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&gotonew=1&tid=1350295]: |
0ms |
get settings: |
8ms |
get forum list: |
13ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
56ms |
get topic data: |
9ms |
get first new msg: |
8ms |
get forum data: |
3ms |
get page messages: |
31ms |
get tp. blocked users: |
1ms |
others: | 291ms |
total: | 428ms |
0 / 0 |