開発中に、SVNパッチファイルを使用してWebAPIから認証を削除しようとしています。認証を削除するパッチファイルは正常に機能し、次のようになります。
Index: WebApplication.Api/Global.asax.cs
===================================================================
--- WebApplication.Api/Global.asax.cs (revision 18939)
+++ WebApplication.Api/Global.asax.cs (working copy)
@@ -115,7 +115,7 @@
_dependencyRegister.AddRegistration<WebApplication.Application.Aspects.AuthorisationAspect>();
// WebApplication.Application.CurrentUser
- _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Application.CurrentUser.CurrentUserService>();
+ _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Api.DummyServices.CurrentUserService>();
// WebApplication.Application.Interface.Manager
_dependencyRegister.AddRegistration<WebApplication.Application.Interface.Manager.IAspNetMembershipManager, WebApplication.Application.Manager.AspNetMembershipManager>();
Index: WebApplication.Api/Web.config
===================================================================
--- WebApplication.Api/Web.config (revision 18939)
+++ WebApplication.Api/Web.config (working copy)
@@ -64,14 +64,12 @@
</sessionState>
<httpModules>
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
- <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
- <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
</modules>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
ご覧のとおり、インターフェイスのDI実装を変更し、XML構成ファイルから2つのノードを削除します。
パッチを逆適用する方法がないため(Visual StudioでVisualSVNを使用してパッチを適用しています)、元のパッチファイルに基づいて「逆パッチ」を作成しました。
Index: WebApplication.Api/Global.asax.cs
===================================================================
--- WebApplication.Api/Global.asax.cs (revision 18939)
+++ WebApplication.Api/Global.asax.cs (working copy)
@@ -115,7 +115,7 @@
_dependencyRegister.AddRegistration<WebApplication.Application.Aspects.AuthorisationAspect>();
// WebApplication.Application.CurrentUser
+ _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Application.CurrentUser.CurrentUserService>();
- _dependencyRegister.AddRegistration<WebApplication.Application.CurrentUser.ICurrentUserService, WebApplication.Api.DummyServices.CurrentUserService>();
// WebApplication.Application.Interface.Manager
_dependencyRegister.AddRegistration<WebApplication.Application.Interface.Manager.IAspNetMembershipManager, WebApplication.Application.Manager.AspNetMembershipManager>();
Index: WebApplication.Api/Web.config
===================================================================
--- WebApplication.Api/Web.config (revision 18939)
+++ WebApplication.Api/Web.config (working copy)
@@ -64,14 +64,12 @@
</sessionState>
<httpModules>
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
+ <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
+ <add name="ProtectedResourceModule" type="WebApplication.Api.Modules.ProtectionModule"/>
</modules>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
むしろ単純に、私が行ったのは+記号を-に変更することだけです。その逆も同様です。これにより、私にとって意味のある逆パッチファイルが作成されます。
逆パッチは正常に機能しますが、XML構成ファイルの最後の「行追加」と行の追加によって次の行のいくつかが削除され、XMLの形式が正しくなくなります。
誰かがこれがなぜであるかアドバイスできますか?魔法で何かする必要があります@@ -64,14 +64,12 @@
か?