简体   繁体   English

在T4模板中使用COM对象?

[英]Using COM objects in a T4 template?

I'm new to Visual Studio's T4 template engine, and I'm wondering how I can use COM objects to build templates. 我是Visual Studio的T4模板引擎的新手,我想知道如何使用COM对象构建模板。 Specifically, SQL-DMO (to generate classes from stored procedures on a SQL 2000 server, SNO is not an option). 特别是SQL-DMO(要从SQL 2000服务器上的存储过程生成类,则不能选择SNO)。

Have any of you guys done this? 你们有做过吗? Any tips? 有小费吗?

<#@ import namespace="SQLDMO" #>

is not working. 不管用。

Thanks! 谢谢!

You can use SMO 2008 with SQL Server 2000 (download here ). 您可以将SMO 2008与SQL Server 2000一起使用( 在此处下载)。

In order to use a COM object, you need to reference its primary interop assembly with use <#@ assembly #> directive first. 为了使用COM对象,您需要先使用<#@ assembly#>指令引用其主互操作程序集。 If the assembly is not available, you can generate it with tlbimp. 如果程序集不可用,则可以使用tlbimp生成它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM