{"id":17761677,"url":"https://github.com/pathoschild/configstringparser","last_synced_at":"2025-05-12T21:00:25.580Z","repository":{"id":36320501,"uuid":"40625166","full_name":"Pathoschild/ConfigStringParser","owner":"Pathoschild","description":"Provides a strongly-typed parser for building and consuming arbitrary connection strings.","archived":false,"fork":false,"pushed_at":"2017-06-24T19:05:36.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T19:28:45.020Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pathoschild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-12T21:27:00.000Z","updated_at":"2023-06-07T09:09:45.000Z","dependencies_parsed_at":"2022-09-16T04:00:24.770Z","dependency_job_id":null,"html_url":"https://github.com/Pathoschild/ConfigStringParser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pathoschild%2FConfigStringParser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pathoschild%2FConfigStringParser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pathoschild%2FConfigStringParser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pathoschild%2FConfigStringParser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pathoschild","download_url":"https://codeload.github.com/Pathoschild/ConfigStringParser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823409,"owners_count":21969845,"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-10-26T19:42:41.395Z","updated_at":"2025-05-12T21:00:23.202Z","avatar_url":"https://github.com/Pathoschild.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿**ConfigStringParser** is a tiny library which lets you read and write any configuration values into a [\u003cs\u003econnection\u003c/s\u003e config string](https://en.wikipedia.org/wiki/Connection_string), and convert freely between string and object representations:\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003econfig string\u003c/th\u003e\n\u003cth\u003e↔\u003c/th\u003e\n\u003cth\u003eC# class\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\u003cpre\u003e\nHostName=example.com; Port=587; EnableSsl=true\n\u003c/pre\u003e\n\u003c/td\u003e\n\u003ctd\u003e↔\u003c/td\u003e\n\u003ctd\u003e\n\u003cpre\u003e\npublic class EmailConfig\n{\n   public string HostName { get; set;}\n   public int Port { get; set; }\n   public bool EnableSSL { get; set;}\n}\n\u003c/pre\u003e\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Usage\n### Creating a config string\nYou can create a new config string from scratch:\n\n```c#\nvar parser = new ConfigStringParser();\nparser.Add({ hostName = \"example.com\", port = 587, enableSSL = true });\n```\n\n...or start from one you have:\n\n```c#\nvar parser = new ConfigStringParser(\"HostName=example.com; Port=587; EnableSsl=true\");\n```\n\nYou can freely add, remove, and overwrite values (keys aren't case sensitive):\n\n```c#\nparser.Add(\"UserName\", \"johnny\");\nparser[\"username\"] = \"billy\";\nparser.Remove(\"username\");\n```\n\n### Mapping to an object\nYou can freely map the config string into an object:\n\n  ```c#\n  EmailConfig config = parser.MapTo\u003cEmailConfig\u003e();\n  ```\n  \n  ...or fill an existing object:\n  \n  ```c#\n  EmailConfig config = new EmailConfig();\n  parser.MapTo(config);\n  ```\n\nYou can optionally add data annotations to your class:\n* [`[Required]`](https://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.requiredattribute.aspx) means the value must be defined. If you try to map a config string without it, you'll get an informative `KeyNotFoundException`.\n* [`[DisplayName(\"Other Name\")]`](https://msdn.microsoft.com/en-us/library/system.componentmodel.displaynameattribute.aspx) provides an alternative name that can appear in the config string. For example, this lets you map a config string like `Host Name=example.com` to a property named `HostName`.\n\nThe parser will automatically map most primitive types (including `bool`, `string`, `Guid`, `double`, `int`, `long`, `short`, and enums), but doesn't handle dates.\n\n### Comparing strings\nYou can check whether a string is equivalent to another one (regardless of order or formatting):\n```c#\nvar parser = new ConfigStringParser(\"HostName=example.com; Port=587; EnableSsl=true\");\nbool isEqual = parser.IsEquivalentTo(\"EnableSSL=true; Port=587; HOSTNAME=example.com\"); // true\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpathoschild%2Fconfigstringparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpathoschild%2Fconfigstringparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpathoschild%2Fconfigstringparser/lists"}