{"id":18699978,"url":"https://github.com/smack0007/componentglue","last_synced_at":"2025-11-08T20:30:33.777Z","repository":{"id":1945307,"uuid":"2874881","full_name":"smack0007/ComponentGlue","owner":"smack0007","description":"A lightweight dependency injection / IoC container.","archived":false,"fork":false,"pushed_at":"2013-07-22T18:34:16.000Z","size":480,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T05:17:03.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://zacharysnow.net","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/smack0007.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-29T12:55:45.000Z","updated_at":"2013-09-30T15:54:18.000Z","dependencies_parsed_at":"2022-09-20T02:11:24.084Z","dependency_job_id":null,"html_url":"https://github.com/smack0007/ComponentGlue","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smack0007%2FComponentGlue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smack0007%2FComponentGlue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smack0007%2FComponentGlue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smack0007%2FComponentGlue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smack0007","download_url":"https://codeload.github.com/smack0007/ComponentGlue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239561398,"owners_count":19659447,"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":[],"created_at":"2024-11-07T11:35:05.983Z","updated_at":"2025-02-18T22:28:28.645Z","avatar_url":"https://github.com/smack0007.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Component Glue\n==============\n\nComponent Glue is a dependency injection / IoC container. Component Glue has a fluent syntax and aims to be simple to use.\n\nKey Features\n------------\n\n* **Fluent Syntax** - Use a fluent syntax to glue together your components.\n* **Auto Binding** - The cotainer can look through an assembly an automatically wire up interfaces which only have one implementing component.\n* **Auto Factories** - Just request a Func\u003cT\u003e in a component and the container will inject a factory that will resolve the binding.\n* **Multi Binding** - Components can receive arrays of dependencies using ToMultiple.\n\n\nGetting Started\n---------------\n\n_The following code snippets are taken from the provided demo program._\n\nThe first thing you'll need to do is instaniate an instance of the container and set your first binding.\n\n\tComponentContainer container = new ComponentContainer();\n\tcontainer.Bind\u003cIBar\u003e().To\u003cBar\u003e().AsTransient();\n\t\nThis code snippet above binds the component type IBar to the concrete type Bar as transient. Transient means there\nwill be a new instance of Bar constructed every time a component requires an instance of IBar. This is binding is also\nglobal as we did not specify any component to which the binding is specific. This can be done with the For syntax.\n\n\tcontainer.For\u003cFoo\u003e.Bind\u003cIBar\u003e().To\u003cOtherBar\u003e().AsSingleton();\n\t\nThis code snippet says for the component Foo, the interface IBar should be bound to the component OtherBar. It also\nspecifies that OtherBar should be used as a singleton. This means that when multiple instances of Bar are constructed,\nthey will all have the same instance of OtherBar. Let's get an instance of Foo.\n\n\tFoo foo = container.Resolve\u003cFoo\u003e();\n\t\nResolve constructs an instance of Foo and resolves the IBar constructor parameter. Even though we used Foo in a For clause,\nwe have not created a binding for Foo in any way. The container will therefore always construct a new instance of Foo.\n\nBindings are not just for interfaces though. Bindings can also be made on class types as well. We can make a binding for\nthe type Foo and bind it to itself.\n\n\tcontainer.Bind\u003cFoo\u003e().ToSelf().AsSingleton();\n\nThe component type Foo is now bound to the concrete type Foo as a singleton. Resolving Foo multiple times will now return\nthe same instance.\n\nSyntax\n------\n\t[For]\n\t\tBind | Rebind\n\t\t\tTo | ToSelf\n\t\t\t\tAs | AsTransient | AsSingleton\n\t\t\t\t\tWithConstructorParameter\n\t\t\tToConstant\n\t\t\tToFactoryMethod\n\t\t\tToMultiple\n\t\t\t\tAdd\n\t\t\t\t\tAs | AsTransient | AsSingleton\n\t\t\t\t\t\tWithConstructorParameter | WithPropertyValue\n\t\t\t\t\t\t\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmack0007%2Fcomponentglue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmack0007%2Fcomponentglue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmack0007%2Fcomponentglue/lists"}