質問

i have core T4 templates in subsonic to create my DAL. Connection strings which i have users which have selective access to different schemas in the database.

problems arise when i try to generate my DAL partial classes for a user which has access to two schemas both having an object (say a table) with the same name.

so if my user has access to MYSCHEMA1 and MYSCHEMA2 and both of these schemas contain an object with the name COMMONOBJECT, the transformations in subsonic fails.

here's the error i get

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)

i do not want to delete one of those objects.

is there a way i can configure subsonic to use 'fully qualified names' like MYSCHEMA1.COMMONOBJECT to use when running transformations?

役に立ちましたか?

解決

Modify your tt template, first find out the schema, then use it to prefix the objects in your example -- tables, e.g. myschema.employee

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top