- Remove From My Forums
-
Question
-
User2130491911 posted
For the life of me I have no Idea why Entity Framework makes using SQL views sooooooooooooo difficult.
My error
Severity Code Description Project File Line Suppression State Warning Error 6013: The table/view 'CONTESTANTS_DB.db_BOT.VUE_CONTESTANT_SCORE_LOG_SUBTOTALS' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it. CMS C:\APP_DEV\CMS\CMS\Models\CMS_DM_DATA_Model.edmx 1
This silly thing will not let me use my subtotal view because it does not have a Key…. Umm hello EF its a SQL view…
back in the past you could trick this thing by adding a guide or something… Today I seem to be out of luck
Here is my SQL VIEW
SELECT NEWID() AS ID, SC_CONTESTANT_ID, SC_CONTEST_ID, SUM(SC_SCORE) AS SCORE_LOG_SUBTOTALS, COUNT(SC_SCORE) AS NUM_LOG_ENTRIES FROM db_BOT.SC_SCORECARD_TBL GROUP BY SC_CONTESTANT_ID, SC_CONTEST_ID
If I knew of something other than EF I would use it… but I only know how to use EF… so has my project come to an end?
Is there no way around this nonsense?
Thanks!
Answers
-
User-1330468790 posted
Hi AppDev01,
Each table or view added to entity model must have some key. However, it actually doesn’t have to be primary key.
Here are two workarounds:
- The first option is to open the EDMX with the view in designer mode and assign a primary key yourself. It doesn’t matter really what it is, as long as there is one. You right-click on the column you want to set as primary key and select
Entity
(it’s a checkbox option). You may have to exit and restart Visual Studio until this warning decides to go away.
Key
- The second way is to force entity framework to use a column as a primary key using
ISNULL. By contrast, if you want to force entity framework not to use a column as a primary key, use
NULLIF.
Related link from Stack Overflow:
First option: https://stackoverflow.com/a/24792529/12871232
Second option: https://stackoverflow.com/a/2715299/12871232
Hope helps.
Best regards,
Sean
-
Marked as answer by
Thursday, October 7, 2021 12:00 AM
- The first option is to open the EDMX with the view in designer mode and assign a primary key yourself. It doesn’t matter really what it is, as long as there is one. You right-click on the column you want to set as primary key and select
OKay, I have stuck with these errors for a week, I have googled a lot of solutions, but they all seem not like my situation.
There are two warning errors and multiple warnings after I changed one of the data types in my database and updated Models from the database.
The warnings are:
Message 1 Validation (ASP.Net): Attribute ‘HeaderSelectedCssClass’ is not a valid attribute of element ‘AccordionPane’.
->Warning 17 The variable 'f' is declared but never used
->Warning 15 The variable 'ex' is declared but never used
->Warning 20 The variable 'e' is declared but never used
->Warning 29 Error 6013: The table/view 'C:USERS\APP_DATACMSDB.MDF.dbo.View' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it.
->Warning 28 Error 6013: The table/view 'C:USERS\APP_DATACMSDB.MDF.dbo.totalOTHours' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it.
Follow the error I have found the exact file in my project and I realize these two are not even a table.
So, how should I deal with it?
Any suggestions are appreciated.
Помогаю со студенческими работами здесь
Visual Studio 2005 и Visual Studio 2008 сильно ли они отличаются друк от друга?
привет ребята:)
вот у меня есть Visual Studio 2005 и Visual Studio 2008 возник вопрос сильно ли…
В коде возникли ошибки при переходе с Visual studio 2013 на Visual studio 2017
Добрый день, решил попробовать поменять свою 2013 студию на 2017 и заметил такую проблему, при…
Имеются ли отличия в компиляторах у сред разработки Visual Studio 2006 и Visual Studio 2015 ?
скажите а где найти среду 2006 года? или можно использовать 2015 год?
Зачем для создания формы на Angular использовать Visual Studio и Visual Studio Code?
Мне нужно написать форму на ангуляре, которая будет выполнять Select, Insert,Delete из базы данных….
Будет ли всегда программа написанная на Visual Studio 2010 открываться в Visual Studio 2003 ?
Будет ли всегда программа написанная на Visual Studio 2010 открываться в Visual Studio 2003 ?
Скажите если я напишу программу на C# в MS Visual studio 2012 на framework 3.5 я потом смогу открыть проект моей программы на MS Visual studio 2008
Скажите если я напишу программу на C# в MS Visual studio 2012 на framework 3.5 я потом смогу…
Искать еще темы с ответами
Или воспользуйтесь поиском по форуму:
@AshleyAS,
After a while, I was able to import a view into the Entity Data Model, however, it has to be done «by hand» in the .edmx file. You need to add the proper definition of your view in the 3 sections of the file (SSDL, CSDL and C-S mapping).
My advice would be to import a table that is similar to the result of your view into your Data Model. Edit your .edmx file with the XML Text Editor and than use the definition of the table that’s already mapped to insert the same fields for your view.
Don’t forget to specify the primary key for your view in the SSDL and CSDL sections and to declare the properties used for the key as Nullable=»false». It should somehow look like this :
<EntityType Name="viewName">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="OtherId" />
</Key>
<Property Name="Id" Type="int2" Nullable="false" />
<Property Name="OtherId" Type="int2" Nullable="false" />
<Property Name="Description" Type="varchar" MaxLength="100" />
</EntityType>
The downside of this method is that all your modifications to the .edmx file will be erased whenever you add/remove a table through the function «Update Model from Database». So make sure you keep backups of your modifications. This solution was not reliable enough for us, so we moved to the commercial option provided by DevArt.
https://www.devart.com/dotconnect/postgresql/
Cheers.
- Remove From My Forums
-
Question
-
Hello,
We have a SQL server 2005 Express edition which generates the following screenshot please check once. Please let me know how to get rid of this error we tried so many times but no clue how to troubleshoot this Issue
We tried to run with NT AutoritySYSTEM and other ways too but there’s no use still we are getting the above error.
I really appreciate if someone suggest resolving steps on this issue!
Thanks Guys!
Answers
-
Hello,
Please examine Schedule Tasks on Control Panel trying to access databases on an existing SQL Server instance on that machine
or a SQL Server instance that once existed on that machine. Maybe that job could be backup job for SQL Server, but the SQL Server instance no longer exists.
Verify on backup software like Backup Exec, for example.
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com-
Marked as answer by
Tuesday, August 11, 2015 8:59 AM
-
Marked as answer by
Номер ошибки: | Ошибка 6013 | |
Название ошибки: | Unable to remove item | |
Описание ошибки: | Unable to remove item. ‘|’ not found in list.@@@1@@@1. | |
Разработчик: | Microsoft Corporation | |
Программное обеспечение: | Microsoft Access | |
Относится к: | Windows XP, Vista, 7, 8, 10, 11 |
Оценка «Unable to remove item»
Эксперты обычно называют «Unable to remove item» «ошибкой времени выполнения». Когда дело доходит до Microsoft Access, инженеры программного обеспечения используют арсенал инструментов, чтобы попытаться сорвать эти ошибки как можно лучше. Хотя эти превентивные действия принимаются, иногда ошибки, такие как ошибка 6013, будут пропущены.
Пользователи Microsoft Access могут столкнуться с ошибкой 6013, вызванной нормальным использованием приложения, которое также может читать как «Unable to remove item. ‘|’ not found in list.@@@1@@@1.». После того, как об ошибке будет сообщено, Microsoft Corporation отреагирует и быстро исследует ошибки 6013 проблемы. Затем они исправляют дефектные области кода и сделают обновление доступным для загрузки. Следовательно, разработчик будет использовать пакет обновления Microsoft Access для устранения ошибки 6013 и любых других сообщений об ошибках.
Сбой во время выполнения Microsoft Access, как правило, когда вы столкнетесь с «Unable to remove item» в качестве ошибки во время выполнения. Мы рассмотрим основные причины ошибки 6013 ошибок:
Ошибка 6013 Crash — она называется «Ошибка 6013», когда программа неожиданно завершает работу во время работы (во время выполнения). Как правило, это результат того, что Microsoft Access не понимает входные данные или не знает, что выводить в ответ.
Утечка памяти «Unable to remove item» — Когда Microsoft Access обнаруживает утечку памяти, операционная система постепенно работает медленно, поскольку она истощает системные ресурсы. Возможные причины из-за отказа Microsoft Corporation девыделения памяти в программе или когда плохой код выполняет «бесконечный цикл».
Ошибка 6013 Logic Error — Вы можете столкнуться с логической ошибкой, когда программа дает неправильные результаты, даже если пользователь указывает правильное значение. Это может произойти, когда исходный код Microsoft Corporation имеет уязвимость в отношении передачи данных.
В большинстве случаев проблемы с файлами Unable to remove item связаны с отсутствием или повреждением файла связанного Microsoft Access вредоносным ПО или вирусом. Основной способ решить эти проблемы вручную — заменить файл Microsoft Corporation новой копией. Мы также рекомендуем выполнить сканирование реестра, чтобы очистить все недействительные ссылки на Unable to remove item, которые могут являться причиной ошибки.
Ошибки Unable to remove item
Частичный список ошибок Unable to remove item Microsoft Access:
- «Ошибка приложения Unable to remove item.»
- «Unable to remove item не является программой Win32. «
- «Извините, Unable to remove item столкнулся с проблемой. «
- «Unable to remove item не может быть найден. «
- «Отсутствует файл Unable to remove item.»
- «Ошибка запуска программы: Unable to remove item.»
- «Не удается запустить Unable to remove item. «
- «Отказ Unable to remove item.»
- «Ошибка пути программного обеспечения: Unable to remove item. «
Эти сообщения об ошибках Microsoft Corporation могут появляться во время установки программы, в то время как программа, связанная с Unable to remove item (например, Microsoft Access) работает, во время запуска или завершения работы Windows, или даже во время установки операционной системы Windows. Важно отметить, когда возникают проблемы Unable to remove item, так как это помогает устранять проблемы Microsoft Access (и сообщать в Microsoft Corporation).
Причины ошибок в файле Unable to remove item
Большинство проблем Unable to remove item связаны с отсутствующим или поврежденным Unable to remove item, вирусной инфекцией или недействительными записями реестра Windows, связанными с Microsoft Access.
Точнее, ошибки Unable to remove item, созданные из:
- Поврежденные ключи реестра Windows, связанные с Unable to remove item / Microsoft Access.
- Вирус или вредоносное ПО, повреждающее Unable to remove item.
- Вредоносное удаление (или ошибка) Unable to remove item другим приложением (не Microsoft Access).
- Другое программное обеспечение, конфликтующее с Microsoft Access, Unable to remove item или общими ссылками.
- Поврежденная установка или загрузка Microsoft Access (Unable to remove item).
Продукт Solvusoft
Загрузка
WinThruster 2022 — Проверьте свой компьютер на наличие ошибок.
Совместима с Windows 2000, XP, Vista, 7, 8, 10 и 11
Установить необязательные продукты — WinThruster (Solvusoft) | Лицензия | Политика защиты личных сведений | Условия | Удаление
OKay, I have stuck with these errors for a week, I have googled a lot of solutions, but they all seem not like my situation.
There are two warning errors and multiple warnings after I changed one of the data types in my database and updated Models from the database.
The warnings are:
Message 1 Validation (ASP.Net): Attribute ‘HeaderSelectedCssClass’ is not a valid attribute of element ‘AccordionPane’.
->Warning 17 The variable 'f' is declared but never used
->Warning 15 The variable 'ex' is declared but never used
->Warning 20 The variable 'e' is declared but never used
->Warning 29 Error 6013: The table/view 'C:\USERS\\APP_DATA\CMSDB.MDF.dbo.View' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it.
->Warning 28 Error 6013: The table/view 'C:\USERS\\APP_DATA\CMSDB.MDF.dbo.totalOTHours' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it.
Follow the error I have found the exact file in my project and I realize these two are not even a table.
So, how should I deal with it?
Any suggestions are appreciated.
Sorted by:
Reset to default
Your Answer
Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more
Sign up or log in
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Name
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.
Browse other questions tagged
- .net
- postgresql
- asp.net-mvc-4
- entity-framework-6
- npgsql
or ask your own question.
Browse other questions tagged
- .net
- postgresql
- asp.net-mvc-4
- entity-framework-6
- npgsql
or ask your own question.
Помогаю со студенческими работами здесь
Visual Studio 2005 и Visual Studio 2008 сильно ли они отличаются друк от друга?
привет ребята:)
вот у меня есть Visual Studio 2005 и Visual Studio 2008 возник вопрос сильно ли…
В коде возникли ошибки при переходе с Visual studio 2013 на Visual studio 2017
Добрый день, решил попробовать поменять свою 2013 студию на 2017 и заметил такую проблему, при…
Имеются ли отличия в компиляторах у сред разработки Visual Studio 2006 и Visual Studio 2015 ?
скажите а где найти среду 2006 года? или можно использовать 2015 год?
Зачем для создания формы на Angular использовать Visual Studio и Visual Studio Code?
Мне нужно написать форму на ангуляре, которая будет выполнять Select, Insert,Delete из базы данных….
Будет ли всегда программа написанная на Visual Studio 2010 открываться в Visual Studio 2003 ?
Будет ли всегда программа написанная на Visual Studio 2010 открываться в Visual Studio 2003 ?
Скажите если я напишу программу на C# в MS Visual studio 2012 на framework 3.5 я потом смогу открыть проект моей программы на MS Visual studio 2008
Скажите если я напишу программу на C# в MS Visual studio 2012 на framework 3.5 я потом смогу…
Искать еще темы с ответами
Или воспользуйтесь поиском по форуму: