簡體   English   中英

由於跨不同模式的相同對象名稱,子模式轉換在T4模板中失敗

[英]Subsonic transformations failing in T4 template due to same object name across different schemas

我有亞音速的核心T4模板來創建我的DAL。 連接字符串,我有用戶可以選擇性地訪問數據庫中的不同模式。

當我嘗試為有權訪問兩個模式的用戶生成我的DAL部分類時會出現問題,這兩個模式都有一個具有相同名稱的對象(比如一個表)。

因此,如果我的用戶可以訪問MYSCHEMA1和MYSCHEMA2,並且這兩個模式都包含名為COMMONOBJECT的對象,則亞音速中的變換將失敗。

這是我得到的錯誤

Running transformation: System.InvalidOperationException: Sequence contains more than one matching element
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.VisualStudio.TextTemplating1A7026BAC93607B56DDB080E7C2EC2DB.GeneratedTextTransformation.LoadTables()
   at Microsoft.VisualStudio.TextTemplating1A7026BAC93607B56DDB080E7C2EC2DB.GeneratedTextTransformation.TransformText()
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)

我不想刪除其中一個對象。

有沒有辦法我可以配置亞音速使用MYSCHEMA1.COMMONOBJECT等“完全限定名稱”來運行轉換時使用?

修改你的tt模板,首先找出模式,然后使用它來為你的例子中的對象添加前綴 - 表格,例如myschema.employee

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM