Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
[ Team LiB ] Recipe 1.12 Storing Connection Strings Problem You need to choose the best place to store connection strings that you need in your application to increase maintainability, simplify future modifications, and eliminate the need to recompile the application when it is modified. | Team LiB Recipe 1.12 Storing Connection Strings Problem You need to choose the best place to store connection strings that you need in your application to increase maintainability simplify future modifications and eliminate the need to recompile the application when it is modified. Solution There are several alternatives for storing connection strings including hard-coding the connection string in your application storing it in an application configuration file or the Windows Registry representing it using a Universal Data Link UDL file or in a custom file. Discussion A connection string is made up of a semi-colon delimited collection of attribute value pairs that define how to connect a data source. Although connection strings tend to look similar the available and required attributes are different depending on the data provider and on the underlying data source. There are a variety of options providing differing degrees of flexibility and security. Persist Security Info The Persist Security Info connection string attribute specifies whether the data source can hang on to or persist sensitive information such as user authentication credentials. Its value should be kept at the default false. If its value is true the connection information including the password can be obtained by querying the connection allowing an untrusted party to have access to sensitive information when a Connection is passed or persisted to a disk. This is an issue only when passing connected objects such as Connection or DataAdapter disconnected objects such as DataSet and DataTable do not store information about the original source of their data. Before a data source object is initialized for the first time sensitive information can be retrieved from it regardless of the setting of the Persist Security Info property. Avoid passing uninitialized data source objects. The Persist Security Info connection string attribute is supported by the SQL Server OLE DB and Oracle .NET Framework data .