{"id":19495759,"url":"https://github.com/zarusz/lightdatainterface","last_synced_at":"2025-11-18T20:03:35.349Z","repository":{"id":112870540,"uuid":"59726755","full_name":"zarusz/LightDataInterface","owner":"zarusz","description":"Common interface to work with your data access layer. Minimizes boiler plate code, dependency on your persistence framework (NHibernate/EntityFramework/MongoDriver) and adds some helpers for common scenarios.","archived":false,"fork":false,"pushed_at":"2017-07-20T00:38:31.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T18:43:40.732Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zarusz.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":"2016-05-26T06:46:39.000Z","updated_at":"2020-09-30T21:33:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"b968b343-ef06-4437-878d-94de9c740b69","html_url":"https://github.com/zarusz/LightDataInterface","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zarusz/LightDataInterface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarusz%2FLightDataInterface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarusz%2FLightDataInterface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarusz%2FLightDataInterface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarusz%2FLightDataInterface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zarusz","download_url":"https://codeload.github.com/zarusz/LightDataInterface/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarusz%2FLightDataInterface/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285129556,"owners_count":27119601,"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-11-18T02:00:05.759Z","response_time":61,"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-10T21:38:47.924Z","updated_at":"2025-11-18T20:03:35.333Z","avatar_url":"https://github.com/zarusz.png","language":"C#","readme":"# LightDataInterface\n\nThis project is in BETA stage.\n\n## Benefits\n\n* Common and light data access interface enables your client code to be independent of the specific DAL technology (e.g. NHibernate).\n* Easier to switch from an existing DAL implementation (e.g. NHibernate) to another (e.g. Entity Framework).\n* Eliminates boilerplate in DAL client code (e.g. starting a transaction, or opening a data session).\n* Enables to have both DAL implementations (e.g. ADO.NET + NHibernate) transparent to the DAL client code.\n* Ability to have more than one database/store and transparently bind repository implementation to use the appropiate database/store.\n\n## Features\n\n### Common interfaces\nThe DAL client code (e.g. application layer) uses minimalistic and straightforward interfaces to coordinate the data access layer. No dependencies on any particular framework (e.g. NHibernate, ADO.NET or EntityFramework).\n\n* `IDataSession`\n* `IUnitOfWork`\n* `IDataSessionFactory`\n* `IUnitOfWorkFactory`\n* `DataSession`\n\nWhen you decide to move to a different data access implementation or have two different DAL strategies - this gets easier.\n\nPackage: `LightDataInterface`\n\n### Providers for your favorite data access framework\n\n* Adapter for EntityFramework\n  * Package: `LightDataInterface.EntityFramework`\n* Adapter for NHibernate (*pending*)\n  * Package: `LightDataInterface.NHibernate`\n* Adapter for MongoDb (*roadmap/future*)\n* Adapter for ADO.NET (*roadmap/future*)\n\n### WebApi integration\n\n`[UnitOfWork]` attribute wraps controller's action in a transaction (`UnitOfWork`). When the action executes successfully the transaction is commited automatically, otherwise when an exception occurs the transaction is rolled back automatically. \n\n```CS\n[HttpPost]\n[Route(\"{markId}/Like\")]\n[UnitOfWork] // method wrapped in a transaction\npublic HttpResponseMessage Like(int markId, bool value)\n{\n    var mark = _markRepo.FindById(markId, MarkFetchStrategy.Like);\n    if (mark == null)\n    {\n        return Request.CreateResponse(HttpStatusCode.NotFound);\n    }\n\n    mark.SetLiked(CurrentUser, value);\n    return Request.CreateResponse(HttpStatusCode.OK);\n}\n```\n\nPackage: `LightDataInterface.Extra.WebApi`\n\n## Examples\n\n### Entity Framework and WebApi example\n\n#### Domain model layer\n\nToDo\n\n#### Services layer (WebApi)\n\nToDo\n\n#### Data access layer (EntityFramework)\n\nToDo\n\n#### Setup/configuration (Autofac)\n\nToDo\n\n## Packages\n\nName | Descripton | Dependencies\n------------ | ------------- | -------------\n`LightDataInterface` | The interfaces to work with LightDataInterface | `Common.Logging`\n`LightDataInterface.Core` | The core classes that help with setup and provide reusable runtime implementation for DAL providers | `LightDataInterface`\n`LightDataInterface.EntityFramework` | Provider for Entity Framework | `LightDataInterface.Core` `EntityFramework`\n`LightDataInterface.Extra.WebApi` | Adds integration goodies for WebApi | `LightDataInterface.Core` `Microsoft.AspNet.WebApi.Core`\n\n## License\n\n[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarusz%2Flightdatainterface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzarusz%2Flightdatainterface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarusz%2Flightdatainterface/lists"}