{"id":20021683,"url":"https://github.com/bugmaker-237/extendedsqldependency","last_synced_at":"2025-09-03T05:43:34.351Z","repository":{"id":38000870,"uuid":"180158454","full_name":"bugMaker-237/ExtendedSqlDependency","owner":"bugMaker-237","description":".Net 4.0 component which receives SQL Server table changes into your .net code.","archived":false,"fork":false,"pushed_at":"2022-12-08T04:25:33.000Z","size":28,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-20T20:50:30.061Z","etag":null,"topics":["csharp","sqldependency"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bugMaker-237.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}},"created_at":"2019-04-08T13:45:44.000Z","updated_at":"2019-09-05T14:10:52.000Z","dependencies_parsed_at":"2023-01-25T08:30:32.318Z","dependency_job_id":null,"html_url":"https://github.com/bugMaker-237/ExtendedSqlDependency","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bugMaker-237/ExtendedSqlDependency","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugMaker-237%2FExtendedSqlDependency","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugMaker-237%2FExtendedSqlDependency/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugMaker-237%2FExtendedSqlDependency/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugMaker-237%2FExtendedSqlDependency/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bugMaker-237","download_url":"https://codeload.github.com/bugMaker-237/ExtendedSqlDependency/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bugMaker-237%2FExtendedSqlDependency/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273397843,"owners_count":25098234,"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-09-03T02:00:09.631Z","response_time":76,"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":["csharp","sqldependency"],"created_at":"2024-11-13T08:37:44.866Z","updated_at":"2025-09-03T05:43:34.294Z","avatar_url":"https://github.com/bugMaker-237.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExtendedSqlDependency\n.Net 4.0 component which receives SQL Server table changes into your .net code.\n\nInspired and Forked from [dyatchenko](https://github.com/dyatchenko/ServiceBrokerListener)\n\n# How To Use\n\n1. Clone or download the project [ExtendedSqlDependency](https://github.com/bugMaker-237/ExtendedSqlDependency/archive/master.zip) and build the solution.\n2. Add ExtendedSqlDependency.dll to your solution.\n3. Make sure that Service Broker is enabled for your database.\n    \n    ```sql\n    ALTER DATABASE test SET ENABLE_BROKER\n    \n    -- For SQL Express\n    ALTER AUTHORIZATION ON DATABASE::test TO userTest\n    ```\n4. Use the class as defined in the test code project.\n    \n# How to use in multiple apps\n\nYou **must** create listeners with **unique** identities for each app. So, only one listener with a specific identity should exist at the moment. This is made in order to make sure that resources are cleaned up.\n\n# How it works\n\nThe abstract base class `ExtendedSqlDependency\u003cTArgs\u003e` is the one doing most of the work. To add cumtom features you can inherit this class or implement `IExtendedSqlDependency\u003cTArgs\u003e` where `TArgs` must be an implementation of `IBrockerListnerEventArg`. \n\nThis library already has 3 classes implementing `ExtendedSqlDependency\u003cTArgs\u003e`; `SqlTableDependency\u003cT\u003e`, `SqlFieldDependency\u003cTEntity, TResult\u003e` and `SqlConcurrentDependency` (work in progress) which can be used as follows:\n\n```csharp\nvar conStr = \"Data Source=192.168.0.101;Initial Catalog=db;Password=myPass;User ID=myUser\";\nSqlFieldDependency\u003cUnStatut, string\u003e sqlDependency = new SqlFieldDependency\u003cUnStatut, string\u003e(p =\u003e p.Name == \"Code\", conStr, receiveDetails: true, identity: Guid.NewGuid());\nSqlTableDependency\u003cUnStatut\u003e sqlTableDependency = new SqlTableDependency\u003cUnStatut\u003e(conStr, receiveDetails: true, identity: Guid.NewGuid());\n\nsqlTableDependency.ValueChanged += SqlDependency_TableChanged;\nsqlDependency.ValueChanged += SqlDependency_ValueChanged;\n\nsqlDependency.Start();\nsqlTableDependency.Start();\n.\n.\n.\nprivate static void SqlDependency_ValueChanged(object sender, \nServiceBrokerListener.EventArguments.FieldChangedEventArgs\u003cstring\u003e e)\n{\n    Console.WriteLine(\"OldValues : \" + e.OdlValues);\n    Console.WriteLine(\"NewValues : \" + e.NewValues);\n}\n\nprivate static void SqlDependency_TableChanged(object sender, \nServiceBrokerListener.EventArguments.TableChangedEventArgs\u003cUnStatut\u003e e)\n{\n    Console.WriteLine(\"OldValues : \" + JsonConvert.SerializeObject(e.OdlValues, Newtonsoft.Json.Formatting.Indented));\n    Console.WriteLine(\"NewValues : \" + JsonConvert.SerializeObject(e.NewValues, Newtonsoft.Json.Formatting.Indented));\n}\n.\n.\n.\n\n[SqlTableDependency(\"statut\")]\n[XmlRoot(\"STATUT\")]\npublic class UnStatut\n{\n    [SqlFieldDependency(\"Codstat\")]\n    [XmlElement(\"CODSTAT\")]\n    public string Code { get; set; }\n    [SqlFieldDependency(\"LibStat\")]\n    [XmlElement(\"LIBSTAT\")]\n    public string Libelle { get; set; }\n    [SqlFieldDependency(\"Datcre\")]\n    [XmlElement(\"DATCRE\")]\n    public DateTime? Date { get; set; }\n}\n```\nAn ExtendedSqlDependency is mapped to a specific type using the attributes `SqlTableDependency` and `SqlFieldDependency`. Xml attributes must also be defined since the results comme from service broker initially as XML and is the converted by the library to the mapped type if  `SqlTableDependency` is used or to the property type if `SqlFieldDependency` is used.\n\n# Licence\n\n[MIT](LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugmaker-237%2Fextendedsqldependency","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugmaker-237%2Fextendedsqldependency","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugmaker-237%2Fextendedsqldependency/lists"}