{"id":25080829,"url":"https://github.com/maxchistt/jsonproperty.efcore","last_synced_at":"2025-04-15T06:14:53.822Z","repository":{"id":180052216,"uuid":"664506189","full_name":"maxchistt/JsonProperty.EFCore","owner":"maxchistt","description":"An extension for using JSON fields in EF Core without configuring Fluent API","archived":false,"fork":false,"pushed_at":"2023-07-16T22:08:17.000Z","size":96,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T06:14:47.769Z","etag":null,"topics":["csharp","dotnet","efcore","entity-framework-core","json","json-parser"],"latest_commit_sha":null,"homepage":"https://nuget.org/packages/JsonProperty.EFCore","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/maxchistt.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,"governance":null}},"created_at":"2023-07-10T06:14:33.000Z","updated_at":"2024-11-16T23:16:02.000Z","dependencies_parsed_at":"2023-07-12T15:15:19.644Z","dependency_job_id":null,"html_url":"https://github.com/maxchistt/JsonProperty.EFCore","commit_stats":null,"previous_names":["maxchistt/jsonpropertyadapter","maxchistt/jsonproperty.efcore"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchistt%2FJsonProperty.EFCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchistt%2FJsonProperty.EFCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchistt%2FJsonProperty.EFCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxchistt%2FJsonProperty.EFCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxchistt","download_url":"https://codeload.github.com/maxchistt/JsonProperty.EFCore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249016641,"owners_count":21198833,"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":["csharp","dotnet","efcore","entity-framework-core","json","json-parser"],"created_at":"2025-02-07T04:26:42.094Z","updated_at":"2025-04-15T06:14:53.805Z","avatar_url":"https://github.com/maxchistt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JsonProperty.EFCore\n\n[![Version](https://img.shields.io/nuget/vpre/JsonProperty.EFCore.svg)](https://www.nuget.org/packages/JsonProperty.EFCore)\n\n## About\n\nThis project allows you to use JSON fields in EF Core without setting up Fluent API\n\n| Id  | Name  | Price  | Params                                                             |\n| --- | ----- | ------ | ------------------------------------------------------------------ |\n| 1   | Phone | 500    | {\"Camera\":13.5,\"OS\":\"Android 11\",\"Screen\":\"1080x900\",\"Storage\":32} |\n| 2   | Car   | 100000 | {\"MaxSpeed\":300,\"Engine capacity\":6,\"ElectroCar\":false}            |\n| 3   | Bag   | 400    | {\"Voliume\":5,\"Color\":\"Red\"}                                        |\n\n## Instruction\n\nHere are few steps how to use JsonProperty.EFCore project:\n\n1. **Connect the project and specify 'using'**\n\n   ```cs\n   using JsonProperty.EFCore;\n   ```\n\n1. **Create entity model**\n\n   ```cs\n   public class Product\n   {\n       [Key, Required]\n       public int Id { get; set; }\n       public string? Name { get; set; }\n       public decimal? Price { get; set; }\n   }\n   ```\n\n   Or\n\n   ```cs\n   public class Note\n   {\n       [Key, Required]\n       public int Id { get; set; }\n       public string? Header { get; set; }\n   }\n   ```\n\n1. **Create a JSON collection item class if necessary**\n\n   ```cs\n   public class TodoItem\n   {\n       public string? Text { get; set; }\n       public bool? CompleteStatus { get; set; }\n   }\n   ```\n\n1. **Add JSON field property of type `JsonEnumerable`, `JsonList`, `JsonDictionary` or `JsonItem` to your entity model**\n\n   You can use the basic type like `JsonEnumerable` or `JsonDictionary` which uses elements of type object\n\n   ```cs\n   public class Product\n   {\n       [Key, Required]\n       public int Id { get; set; }\n       public string? Name { get; set; }\n       public decimal? Price { get; set; }\n\n       public JsonDictionary Parameters { get; set; } = new();\n   }\n   ```\n\n   Or add property of generic type like `JsonEnumerable\u003cT\u003e` or `JsonDictionary\u003cTKey, TValue\u003e` with custom element type\n\n   ```cs\n   public class Note\n   {\n       [Key, Required]\n       public int Id { get; set; }\n       public string? Header { get; set; }\n\n       public JsonEnumerable\u003cTodoItem\u003e Todos { get; set; } = new();\n   }\n   ```\n\n1. **Usage example:**\n\n   Here is example for `JsonDictionary`\n\n   ```cs\n   Product product = new() {Name=\"Phone\",Price=500.95m,Amount=21,Parameters={\n       VirtualDictionary = new Dictionary\u003cstring,object\u003e() {\n           {\"Camera\",13.5 },{\"OS\",\"Android\" },{\"Screen\",\"1080x900\"},{\"Storage\",32}\n       }\n   }};\n   db.Goods.Add(product);\n   db.SaveChanges();\n   ```\n\n   This will generate the following JSON data into the corresponding table string field:\n\n   ```\n   { \"Camera\": 13.5, \"OS\": \"Android\", \"Screen\": \"1080x900\", \"Storage\": 32 }\n   ```\n\n   Or next if `JsonSettings.StrictTypeSerialization` is 'true' (default)\n\n   ```json\n   {\n     \"Camera\": [13.5, \"System.Double\"],\n     \"OS\": [\"Android\", \"System.String\"],\n     \"Screen\": [\"1080x900\", \"System.String\"],\n     \"Storage\": [32, \"System.Int32\"]\n   }\n   ```\n\n   And here is example for `JsonEnumerable\u003cT\u003e`\n\n   ```cs\n   Note note = db.Notes.FirstOrDefault();\n   note.Todos.Edit(en =\u003e en.Append(new(\"MyTodoItemTitle\")));\n   ```\n\n   And here is also the result in JSON:\n\n   ```\n   [ ... , { \"Text\": \"MyTodoItemTitle\", \"CompleteStatus\": false }]\n   ```\n\n   Or\n\n   ```json\n   [\n     {\n       \"Text\": [\"MyTodoItemTitle\", \"System.String\"],\n       \"CompleteStatus\": [false, \"System.Boolean\"]\n     }\n   ]\n   ```\n\nYou can see more at [wiki](https://github.com/maxchistt/JsonProperty.EFCore/wiki)\n\n## Show your support\n\n⭐️ this [repository](https://github.com/maxchistt/JsonProperty.EFCore) if this package helped you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxchistt%2Fjsonproperty.efcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxchistt%2Fjsonproperty.efcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxchistt%2Fjsonproperty.efcore/lists"}