問題描述
我正在使用 Visual Studio 2008 數據庫項目 GDR2 來管理多個數據庫,但我遇到了許多與同義詞相關的錯誤.
I am using Visual Studio 2008 Database Project GDR2 to manage multiple databases and I am getting a number of errors related to synonyms.
Project-A 引用了 Project-B,因為 Project-A 與 Project-B 中的表有許多同義詞.我得到的完整錯誤是TSD04105:模型已經有一個具有相同名稱 dbo.[OBJECT]"的元素.這總是指向同義詞.
Project-A has a reference to Project-B because Project-A has a number of synonyms to tables in Project-B. The full error I'm getting is "TSD04105: The model already has an element that has the same name dbo.[OBJECT]". This always points at the synonym.
問題似乎是 Project-A 上的同義詞與 Project-B 上的表同名.顯然,我可以重命名我所有的同義詞,以便它們具有與表格不同的名稱,但這會為我帶來很多工作(到目前為止有 140 多個同義詞).
The issue seems to be that the synonym on Project-A has the same name as the table on Project-B. Obviously I could rename all my synonyms so that they have different names than the tables, but this introduces a LOT of work on my part (there's over 140 synonyms so far).
刪除對 Project-B 的引用將消除該錯誤,但我在 Project-A 中的所有存儲過程都會生成錯誤,因為它無法再引用 Project-B 中的表.
Removing the reference to Project-B will get rid of that error, but instead all of my stored procedures in Project-A generate errors because it can't reference the tables in Project-B any more.
除了重命名所有同義詞之外,有沒有辦法解決這個問題?在數據庫項目中處理這種情況的適當方法是什么?
Is there a way to fix this problem short of renaming all the synonyms? What is the appropriate way to handle this situation in the Database Project?
推薦答案
我在 2008 服務器項目和數據庫項目之間遇到了這個問題,我通過使用文字數據庫變量值解決了這個問題.
I had this issue between a 2008 server project and a database project and I solved it by using a literal Database Variable Value.
引用項目屬性 -> 引用選項卡 -> 數據庫變量值
Referencing project properties -> References Tab -> Database Variable Value
我想說您也可以使用數據庫變量名稱/值對.
I would say that you could also use a Database Variable Name/Value pair as well.
這篇關于“模型已經有一個元素"使用 Visual Studio 2008 數據庫項目 GDR2 時出現錯誤 (TSD04105)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!