반응형
구성 변환을 사용하여 ConnectionString을 제거하는 방법
여러 ConnectionStrings가있는 Web.config가 있습니다.
<connectionStrings>
<add name="connStr1" connectionString="...
<add name="ConnStr2" connectionString="...
<add name="connStr3" connectionString="...
구성 변환을 사용하여 특정 연결 문자열을 제거하는 방법이 있습니까? 같은 것 :
<connectionStrings>
<xdt:Remove connStr2?
분명히 정확한 구문 근처에는 없지만 내 드리프트가 있습니다 ...
주제에 대한 MSDN 문서 에서 :
<configuration xmlns:xdt="...">
<connectionStrings>
<add xdt:Transform="Remove" />
</connectionStrings>
</configuration>
은 Transform="Remove"
당신이 찾고있는 마법이다. 또한이 Transform="RemoveAll"
특정 추가 기능 (들)와 함께 사용할 수 있습니다있다.
편집하다
제 생각에 당신은 또한 결합 할 수 있습니다 Locator
속성을 에 Remove
당신이 실제로 삭제할 요소 한계 이상으로 정의했다.
보다 명확하게 :
<configuration xmlns:xdt="...">
<connectionStrings>
<add xdt:Transform="Remove" xdt:Locator="XPath(configuration/connectionStrings[@name='ConnStr2'])" />
</connectionStrings>
</configuration>
또는 유사하게 작동합니다.
이름에 따라 특정 연결 문자열이 제거됩니다.
<configuration>
<connectionStrings>
<add name="ConnStr2" xdt:Transform="Remove" xdt:Locator="Match(name)" connectionString=" " />
</connectionStrings>
</configuration>
점을 유의 connectionString
값이 빈 문자열이 아니라 대신 공간입니다. 비어 있지 않은 값은 가능합니다.
반응형
'Nice programing' 카테고리의 다른 글
mongodb 컬렉션에서 최대 가치를 얻는 방법 (0) | 2020.11.16 |
---|---|
정규식의 유효성을 어떻게 확인할 수 있습니까? (0) | 2020.11.16 |
div 내에서 두 줄로만 텍스트 감싸기 (0) | 2020.11.16 |
strcpy 대 strdup (0) | 2020.11.16 |
인수 'fn'은 문자열이있는 함수가 아닙니다. (0) | 2020.11.16 |