{"id":20605170,"url":"https://github.com/arnab-developer/optionpatterndemo","last_synced_at":"2025-08-11T02:05:06.104Z","repository":{"id":68915351,"uuid":"356155573","full_name":"Arnab-Developer/OptionPatternDemo","owner":"Arnab-Developer","description":"ASP.NET option pattern demo","archived":false,"fork":false,"pushed_at":"2021-04-21T07:43:01.000Z","size":667,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-21T11:07:30.950Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Arnab-Developer.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":"2021-04-09T06:06:18.000Z","updated_at":"2021-12-05T05:48:18.000Z","dependencies_parsed_at":"2023-03-24T11:19:39.220Z","dependency_job_id":null,"html_url":"https://github.com/Arnab-Developer/OptionPatternDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Arnab-Developer/OptionPatternDemo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnab-Developer%2FOptionPatternDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnab-Developer%2FOptionPatternDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnab-Developer%2FOptionPatternDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnab-Developer%2FOptionPatternDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arnab-Developer","download_url":"https://codeload.github.com/Arnab-Developer/OptionPatternDemo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arnab-Developer%2FOptionPatternDemo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269819032,"owners_count":24480087,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-16T09:26:55.521Z","updated_at":"2025-08-11T02:05:06.066Z","avatar_url":"https://github.com/Arnab-Developer.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ASP.NET option pattern demo\n\nThis is a demo app to show the difference between `IOptionsMonitor`, `IOptions`\nand `IOptionsSnapshot`.\n\n- IOptionsMonitor: always return the new value\n- IOptions: always return the old value until the app is restarted\n- IOptionsSnapshot: return the new value if it is a new request\n\nThere are two action methods, `Index` and `Privacy`. Both the methods are having \nthe same code in it which is getting the value of `Name `from `appsettings` for \n20 times in a loop using `IOptionsMonitor`, `IOptions` and `IOptionsSnapshot`.\n\n```c#\nfor (int i = 0; i \u003c 20; i++)\n{\n    string name1 = _optionsMonitor.CurrentValue.Name;\n    string name2 = _options.Value.Name;\n    string name3 = _optionsSnapshot.Value.Name;\n}\n```\n\nIf you put a breakpoint in the loop in the `Index` method and while the loop is \nexecuting, if you change the value of the `Name` in `appsettings` then you can able \nto see that `IOptionsMonitor` is returning the new value but `IOptions` and \n`IOptionsSnapshot` is returning the old value.\n\nWhen redirect happens from `Index` to `Privacy` then a new request has been made\nand now you can able to see `IOptionsSnapshot` is returning the new value like\n`IOptionsMonitor` but `IOptions` is still returning the old value.\n\nIf you restart the app then you will able to see that `IOptions` is returning the\nnew value like `IOptionsMonitor` and `IOptionsSnapshot`.\n\nFor more information about ASP.NET option pattern, please read \n[this doc](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-5.0).\n\n## Tech stack\n\nVisual Studio 2019 and ASP.NET 5","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnab-developer%2Foptionpatterndemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnab-developer%2Foptionpatterndemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnab-developer%2Foptionpatterndemo/lists"}