阅读类库中的SSIS配置文件值 [英] Read the SSIS config file values in the class library

查看:180
本文介绍了阅读类库中的SSIS配置文件值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个共同的类库和集成该库到多个SSIS包。现在,类库有一些方法,这些读取配置文件中的配置价值。如果我添加这个类库到Web应用程序,然后它工作正常。但是,如果我们这个库添加到SSIS包,然后它显示错误,而从配置文件读取值。一般我们用下面的code读取连接字符串的值

I have created a common class library and integration that library into the multiple SSIS packages. Now that class library have some methods those read the config value from the configuration file. If I add this class library into the Web application then it works fine. But if we add this library to the SSIS package then it does show the error while reading the values from the configuration file. Generally we use the following code to read the value of connection string

connectionString = Convert.ToString(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"]); 

如何使用常用功能显示它将为SSIS包和asp.net web应用程序的工作?

How to use common function show it will work for both SSIS package and asp.net web application?

推荐答案

根据这个<一个href=\"https://social.msdn.microsoft.com/Forums/sqlserver/en-US/81c5ac66-0df4-424b-9198-f0a7d3f475c7/how-to-read-key-value-from-appsetting-in-appconfig-in-script-task?forum=sqlintegrationservices\"相对=nofollow> MSDN上的帖子通过System.Configuration读出的配置是不可能的。

According to this post on msdn is reading out configuration through System.Configuration is not possible.

您可以选择创建外部XML或文本文件,配置项,并从code读出来。

You can choose to create an external xml or text file with configuration items and read them out from your code.

preferred的解决办法是使用SSIS的现有配置结构,并把它们连接到您的程序集API中main.cs。

Preferred solution would be to use the existing configuration structure of ssis and connect them to your assembly API in main.cs.

这篇关于阅读类库中的SSIS配置文件值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆