{"id":18975820,"url":"https://github.com/havit/havit.castlewindsor.webforms","last_synced_at":"2025-04-19T16:54:12.479Z","repository":{"id":104909246,"uuid":"166395090","full_name":"havit/Havit.CastleWindsor.WebForms","owner":"havit","description":"Dependency Injection for ASP.NET WebForms on .NET Framework 4.7.2+","archived":false,"fork":false,"pushed_at":"2021-11-26T11:38:09.000Z","size":43,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-16T12:18:32.622Z","etag":null,"topics":["asp-net","castle-windsor","dependency-injection","webforms"],"latest_commit_sha":null,"homepage":"https://youtu.be/wBfKETZuEVA","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/havit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-18T11:31:59.000Z","updated_at":"2024-12-06T13:11:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"d14cf33c-a8a3-4239-a222-1e572683244a","html_url":"https://github.com/havit/Havit.CastleWindsor.WebForms","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havit%2FHavit.CastleWindsor.WebForms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havit%2FHavit.CastleWindsor.WebForms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havit%2FHavit.CastleWindsor.WebForms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/havit%2FHavit.CastleWindsor.WebForms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/havit","download_url":"https://codeload.github.com/havit/Havit.CastleWindsor.WebForms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249743133,"owners_count":21319059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net","castle-windsor","dependency-injection","webforms"],"created_at":"2024-11-08T15:20:49.990Z","updated_at":"2025-04-19T16:54:12.464Z","avatar_url":"https://github.com/havit.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Havit.CastleWindsor.WebForms\n\n[![NuGet Package](https://img.shields.io/nuget/v/Havit.CastleWindsor.WebForms.svg)](https://www.nuget.org/packages/Havit.CastleWindsor.WebForms) ![Build](https://img.shields.io/azure-devops/build/havit/dev/287.svg)\n\nImplementation of Castle Windsor DI container to ASP.NET WebForms 4.7.2. In previous versions there is no direct support due to mising extensibility point **HttpRuntime.WebObjectActivator**. You can find more details in [news article](https://blogs.msdn.microsoft.com/dotnet/2018/04/30/announcing-the-net-framework-4-7-2/).\n\n## Instalation to existing project\n\n1. Switch *Target framework* for your project to .NET Framework 4.7.2. If you don't have installed .NET Framework 4.7.2 developer pack. You can download it from [here](https://www.microsoft.com/net/download/thank-you/net472-developer-pack). \n\nCheck web.config and targetFramework in httpRuntime section. Both must be set to 4.7.2.\n\n```xml\n\u003csystem.web\u003e\n\t\u003ccompilation debug=\"true\" targetFramework=\"4.7.2\"/\u003e\n\t\u003chttpRuntime targetFramework=\"4.7.2\"/\u003e\n\u003c/system.web\u003e\n```\n\n2. Add nuget package **Havit.CastleWindsor.WebForms**. *Don't forget to reinstall other nuget packges, if you changed Target framework in previous step.*\n3. Install nuget packge **Castle.Windsor**.\n4. Add this initiaizing code to **Application_Start** method in **Global.asax**. Extension method AddWindsorContainer will initialize new container and will use it for resolving dependencies. \n```csharp\nIWindsorContainer container = this.AddWindsorContainer();\n```\n5. Also add using to the header of global.asax\n```csharp\nusing Havit.CastleWindsor.WebForms;\n```\n\n## Working areas\nThere are many areas you can use Dependency Injection in WebForms applications now. Here is a complete list:\n\n- Pages and controls\n  - WebForms page\n  - User control\n  - Custom control\n- IHttpHandler and IHttpHandlerFactory\n- IHttpModule\n- Providers\n  - BuildProvider\n  - ResourceProviderFactory\n  - Health monitoring provider\n  - Any ProviderBase based provider created by System.Web.Configuration.ProvidersHelper.InstantiateProvider. e.g. custom sessionstate provider\n\n## Known limitations\nBecause it is not possible to use Dependency Injection through WebOjectActivator in Web Services (*.asmx), we added a workaround for this case, so you can do dependency injection to web services via properties. \n\n### How to inject to Web Services\n1. Web Service must inherit from the abstract class **Havit.CastleWindsor.WebForms.InjectableWebServiceBase**\n2. Every property, you want to inject must be marked with the attribute **Havit.CastleWindsor.WebForms.InjectAttribute**\n3. Every property, you want to inject must have a **public getter and setter**\n\n## Example \nWe have prepared a simple example appliction with one page and one web service with Dependency Injection. See Havit.CastleWindsor.WebForms.Example appliction.\n\n## Troubleshooting\n1. If you hit the error, that a page (or an user control) cannot be created because of missing a contructor with zero arguments, check if you had switched your project to .NET FW 4.7.2 (don't forget to check compilation and httpRuntime elements in the web.config file).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavit%2Fhavit.castlewindsor.webforms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhavit%2Fhavit.castlewindsor.webforms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhavit%2Fhavit.castlewindsor.webforms/lists"}