{"id":20932362,"url":"https://github.com/ahmadpayan/csharp-simple-ioc-container","last_synced_at":"2025-05-13T20:30:34.332Z","repository":{"id":195510523,"uuid":"120575688","full_name":"AhmadPayan/CSharp-Simple-IoC-Container","owner":"AhmadPayan","description":"A very small C# IoC container based on constructor injection.","archived":false,"fork":false,"pushed_at":"2018-04-24T11:39:43.000Z","size":18,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T07:11:16.509Z","etag":null,"topics":["c-sharp","csharp","inversion-of-control","inversionofcontrol","ioc","ioc-container","learning"],"latest_commit_sha":null,"homepage":"","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/AhmadPayan.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}},"created_at":"2018-02-07T06:53:44.000Z","updated_at":"2023-12-20T08:22:09.000Z","dependencies_parsed_at":"2023-09-18T10:38:24.768Z","dependency_job_id":null,"html_url":"https://github.com/AhmadPayan/CSharp-Simple-IoC-Container","commit_stats":null,"previous_names":["ahmadpayan/csharp-simple-ioc-container"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmadPayan%2FCSharp-Simple-IoC-Container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmadPayan%2FCSharp-Simple-IoC-Container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmadPayan%2FCSharp-Simple-IoC-Container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmadPayan%2FCSharp-Simple-IoC-Container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AhmadPayan","download_url":"https://codeload.github.com/AhmadPayan/CSharp-Simple-IoC-Container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020902,"owners_count":22000805,"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":["c-sharp","csharp","inversion-of-control","inversionofcontrol","ioc","ioc-container","learning"],"created_at":"2024-11-18T21:48:18.815Z","updated_at":"2025-05-13T20:30:34.008Z","avatar_url":"https://github.com/AhmadPayan.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharp-Simple-IoC-Container\nA very small IoC container in C#.NET. Just created for learning purpose.\n\nThis is a simple C# Console Application that shows how you can create your own custom IoC Container in the easiest way.\n\n**WARNING: Please do not use this as your project IoC Container,  It lacks many features and functionalities.**\n\n\n**Usage**\n\nIt's simple, Here are the steps:\n1. Define your types and implementations.\n2. Call Resolve method of the container to get desired implementation.\n3. Use it!\n\nSo let's get started!\n\n**1. Register your types like as follows:**\n\n       var container = SimpleIoC.CreateInstance();\n       container.For\u003cIMessageService\u003e().Inject\u003cMessageService\u003e();\n\nOr even simpler use Register method:\n\n    container.Register\u003cILogger, Logger\u003e();\n           \n**2. Then resolve and get an instance of your type like this:**\n\n       var resolvedService = container.Resolve\u003cIMessageService\u003e();\n\n**3. It's done! Enjoy it.**\n\n       resolvedService.SendMessage(\"This is a simple IoC Container!\");\n    \nYou can use Singleton in order to prevent instantiating classes more than once. To do so, add the **UseSingleton()** into your container:\n\n    var container = SimpleIoC.CreateInstance();\n    container.UseSingleton();\n\nBy doing this, All of the objects just creating once.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadpayan%2Fcsharp-simple-ioc-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmadpayan%2Fcsharp-simple-ioc-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadpayan%2Fcsharp-simple-ioc-container/lists"}