{"id":22051374,"url":"https://github.com/obeliskos/loki-aspnetcore","last_synced_at":"2026-05-02T05:07:19.186Z","repository":{"id":115150739,"uuid":"96671110","full_name":"obeliskos/loki-aspnetcore","owner":"obeliskos","description":"asp.net core nodeservices translation layer for interfacing with loki-nodeservice","archived":false,"fork":false,"pushed_at":"2017-09-07T10:02:32.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T22:48:16.784Z","etag":null,"topics":["asp-net-core","lokijs","nodeservices","persistence-layer"],"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/obeliskos.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":"2017-07-09T08:27:50.000Z","updated_at":"2017-07-11T20:51:45.000Z","dependencies_parsed_at":"2023-05-04T23:38:09.645Z","dependency_job_id":null,"html_url":"https://github.com/obeliskos/loki-aspnetcore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/obeliskos/loki-aspnetcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obeliskos%2Floki-aspnetcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obeliskos%2Floki-aspnetcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obeliskos%2Floki-aspnetcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obeliskos%2Floki-aspnetcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obeliskos","download_url":"https://codeload.github.com/obeliskos/loki-aspnetcore/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obeliskos%2Floki-aspnetcore/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260713324,"owners_count":23050824,"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":["asp-net-core","lokijs","nodeservices","persistence-layer"],"created_at":"2024-11-30T15:08:48.178Z","updated_at":"2026-05-02T05:07:14.166Z","avatar_url":"https://github.com/obeliskos.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loki-aspnetcore\nasp.net core translation layer for interfacing with loki-nodeservice\n\n# Overview\nThis library contains generic reusable c# abstractions for interfacing with :\n- LokiDatabase\n- LokiCollections\n- Query Chaining and Transforms\n- loki-nodeservice statistics and collection information\n\n# Nuget\nThis library has been published as [loki-aspnetcore on nuget](https://www.nuget.org/packages/loki-aspnetcore/) so applications wishing\nto use this library should add a reference in their csproj file to : \n```xml\n    \u003cPackageReference Include=\"loki-aspnetcore\" Version=\"1.0.0\" /\u003e\n```\n\n# Usage\n\n\u003e Note that in order to use this library, you will need an npm library (loki-nodeservice) which we demonstrate more fully in our [loki-aspnetcore-example](https://github.com/obeliskos/loki-aspnetcore-example) repository.\n\nGenerally you will need to bootstrap logic into each Controller for interfacing with loki-aspnetcore and its node.js library\nvia a Controller constructor such as :\n```csharp\n        private LokiDatabaseConfiguration _demoServiceConfiguration;\n        \n        public UserController(IHostingEnvironment env)\n\n        {\n            _env = env;\n\n            _demoServiceConfiguration = new LokiDatabaseConfiguration(\n                \"./node_modules/loki-nodeservice/lokiservice.js\", \n                env.ContentRootPath.Replace(\"\\\\\", \"/\") + \"/nodesvcs/demo1-service.init.js\", \n                \"./dbinstances/demo-1.db\"\n            );            \n        }\n        \n```\n \nThat somewhat ugly bit of path resolution should suffice for abstraction of the loki-nodeservice node module as well as your \ncustom service initializer (also demonstrated in our [loki-aspnetcore-example](https://github.com/obeliskos/loki-aspnetcore-example)).\nYour service initializer will be called by the loki-nodeservice for defining/creating/spinning up instanc(es) of the databases you initialize in \nyour initializer. loki-nodeservice, in turn, will be called by nodeservices, which in turn, will be called by asp.net nodeservices, \nwhich is called by your controller.  The above definition of a global LokiDatabaseConfiguration object will contain most of the \npathing 'glue' needed for that to work.\n\nHaving established that configuration object and your c# concrete classes, you might have controller actions which query a \ncollection such as this view action : \n```csharp\n        public async Task\u003cIActionResult\u003e Index([FromServices] INodeServices nodeServices)\n        {\n            LokiDatabase db = new LokiDatabase(nodeServices, _demoServiceConfiguration);\n\n            List\u003cUser\u003e result = await db.Find\u003cUser\u003e(\"users\");\n\n            return View(result);\n        }\n```\n\nNote the asp.net nodeservices dependency injection and our configuration object are passed to resolve a LokiDatabase instance \nwhich we can use to query.  The creation of the LokiDatabase is for establishing configuration only for subsequent method invocations \nto be able to resolve how to address the node service. \n\n# Detailed Example\n_Please see our for an example on how you_\n_might use this library, along with loki-nodeservice npm package and asp.net nodeservices to completely host, query, and_\n_obtain statistic on lokijs database(s)._\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobeliskos%2Floki-aspnetcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobeliskos%2Floki-aspnetcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobeliskos%2Floki-aspnetcore/lists"}