{"id":27105148,"url":"https://github.com/xrm-oss/xrm-fluent-query","last_synced_at":"2025-07-11T05:34:55.813Z","repository":{"id":64080851,"uuid":"131221043","full_name":"XRM-OSS/Xrm-Fluent-Query","owner":"XRM-OSS","description":"A fluent interface for readable and short Dynamics 365 queries","archived":false,"fork":false,"pushed_at":"2024-07-26T11:44:19.000Z","size":604,"stargazers_count":14,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T05:58:02.759Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XRM-OSS.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":"2018-04-26T23:29:44.000Z","updated_at":"2025-02-14T03:40:04.000Z","dependencies_parsed_at":"2023-01-14T20:58:54.472Z","dependency_job_id":null,"html_url":"https://github.com/XRM-OSS/Xrm-Fluent-Query","commit_stats":null,"previous_names":["digitalflow/xrm-fluent-query"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRM-OSS%2FXrm-Fluent-Query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRM-OSS%2FXrm-Fluent-Query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRM-OSS%2FXrm-Fluent-Query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XRM-OSS%2FXrm-Fluent-Query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XRM-OSS","download_url":"https://codeload.github.com/XRM-OSS/Xrm-Fluent-Query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247534604,"owners_count":20954565,"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":"2025-04-06T18:36:53.619Z","updated_at":"2025-04-06T18:36:54.173Z","avatar_url":"https://github.com/XRM-OSS.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XRM Fluent Query [![Build status](https://ci.appveyor.com/api/projects/status/x0o7dqnhnwi2i8bk?svg=true)](https://ci.appveyor.com/project/DigitalFlow/xrm-fluent-query) [![NuGet Badge](https://buildstats.info/nuget/Xrm.Oss.FluentQuery.Sources)](https://www.nuget.org/packages/Xrm.Oss.FluentQuery.Sources)\n\n|Line Coverage|Branch Coverage|\n|-----|-----------------|\n|[![Line coverage](https://cdn.rawgit.com/digitalflow/xrm-fluent-query/master/reports/badge_linecoverage.svg)](https://cdn.rawgit.com/digitalflow/xrm-fluent-query/master/reports/index.htm)|[![Branch coverage](https://cdn.rawgit.com/digitalflow/xrm-fluent-query/master/reports/badge_branchcoverage.svg)](https://cdn.rawgit.com/digitalflow/xrm-fluent-query/master/reports/index.htm)|\n\nThis is a library for fluent query operations in Dynamics CRM / Dynamics365.\n\n# Requirements\nThis library can be used in CRM Plugins / Workflow Activities and in code of external applications. It is distributed as source file, so you don't need to merge DLLs.\nIt does not include references / dependencies to any CRM SDK, so you can just install it and choose the CRM SDK that you need yourself.\nAll CRM versions from 2011 to 365 are supported, just include the one you need to your project.\n\n# Remarks\nThis library sets the NoLock parameter on your QueryExpressions to true by default (plain QueryExpressions don't).\nThis is a recommended best practice, as otherwise the records would be locked in the database before retrieval, which might result in decreased performance.\nNot locking the data before retrieval might result in dirty reads however, if the record has an update transaction executing at the same time.\nThere's also a limit of how much concurrent locked queries can run concurrently. Find out more about NoLock [here](https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.query.queryexpression.nolock.aspx).\n\nIf you choose to lock the data for retrieval, set `service.With.DataBaseLock()`.\n\n# Purpose\nQueryExpressions add nice IntelliSense, however they tend to be quite verbose, which leads to poor readability.\nThis fluent interface aims to make queries as short and readable as possible while preserving IntelliSense.\n\nThis could look something like this (When not developing early bound, you can simply leave out the generic parameter):\n```C#\nvar records = service.Query\u003cAccount\u003e()\n                .IncludeColumns(\"name\", \"address1_line1\")\n                .Where(e =\u003e e\n                    .Attribute(a =\u003e a\n                        .Named(\"name\")\n                        .Is(ConditionOperator.Equal)\n                        .To(\"Adventure Works\")\n                    )\n                )\n                .Link(l =\u003e l\n                    .FromEntity(\"account\")\n                    .FromAttribute(\"primarycontactid\")\n                    .ToEntity(\"contact\")\n                    .ToAttribute(\"contactid\")\n                    .With.LinkType(JoinOperator.LeftOuter)\n                )\n                .RetrieveAll();\n```\n\nThe equivalent QueryExpression for above fluent query would be:\n```C#\nvar query = new QueryExpression\n{\n\tEntityName = \"account\",\n\tColumnSet = new ColumnSet(\"name\", \"address1_line1\"),\n\tNoLock = true,\n\tCriteria = new FilterExpression\n\t{\n\t\tConditions =\n\t\t{\n\t\t\tnew ConditionExpression(\"name\", ConditionOperator.Equal, \"Adventure Works\")\n\t\t}\n\t},\n\tLinkEntities =\n\t{\n\t\tnew LinkEntity\n\t\t{\n\t\t\tLinkFromEntityName = \"account\",\n\t\t\tLinkFromAttributeName = \"primarycontactid\",\n\t\t\tLinkToEntityName = \"contact\",\n\t\t\tLinkToAttributeName = \"contactid\"\n\t\t}\n\t}\n};\n\nvar records = service.RetrieveMultiple(query).Entities.Select(e =\u003e e.ToEntity\u003cAccount\u003e()).ToList();\n```\n\nI believe the fluent syntax to be much easier to understand at first glance. \n\nIn addition to that, it automatically casts your entity objects if you call it with the generic parameter and implements automatic retrieval of all pages.\n\n# How to build it\nIf you want to build this library yourself, just call \n\n```PowerShell\n.\\build.cmd\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrm-oss%2Fxrm-fluent-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxrm-oss%2Fxrm-fluent-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxrm-oss%2Fxrm-fluent-query/lists"}