> For the complete documentation index, see [llms.txt](https://help.santesuite.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.santesuite.org/developers/server-plugins/implementing-.net-features/service-definitions/record-merging-provider.md).

# Record Merging Provider

`IRecordMergingService` in assembly SanteDB.Core.Api version 3.0.1980.0

## Summary

Record merging service

## Operations

| Operation                   | Response/Return                        | Input/Parameter                                                                                                                                     | Description                                                             |
| --------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| GetMergeCandidateKeys       | IEnumerable\<Guid>                     | *Guid* **masterKey**                                                                                                                                | Gets the duplicates for the specified master record                     |
| GetMergeCandidates          | IQueryResultSet\<IdentifiedData>       | *Guid* **masterKey**                                                                                                                                | Get merge candidate keys                                                |
| GetGlobalMergeCandidates    | IQueryResultSet\<ITargetedAssociation> | *none*                                                                                                                                              | TODO                                                                    |
| GetIgnoredKeys              | IEnumerable\<Guid>                     | *Guid* **masterKey**                                                                                                                                | Gets the ignore list for the specified master record                    |
| GetIgnored                  | IQueryResultSet\<IdentifiedData>       | *Guid* **masterKey**                                                                                                                                | Gets the ignore list for the specified master record                    |
| Ignore                      | IdentifiedData                         | <p><em>Guid</em> <strong>masterKey</strong><br><em>IEnumerable\<Guid></em> <strong>falsePositives</strong></p>                                      | Indicates that the engine should ignore the specified false positives   |
| UnIgnore                    | IdentifiedData                         | <p><em>Guid</em> <strong>masterKey</strong><br><em>IEnumerable\<Guid></em> <strong>ignoredKeys</strong></p>                                         | Indicates that an ignored record should be removed from the ignore list |
| Merge                       | RecordMergeResult                      | <p><em>Guid</em> <strong>masterKey</strong><br><em>IEnumerable\<Guid></em> <strong>linkedDuplicates</strong></p>                                    | Merges the specified into                                               |
| Unmerge                     | RecordMergeResult                      | <p><em>Guid</em> <strong>masterKey</strong><br><em>Guid</em> <strong>unmergeDuplicateKey</strong></p>                                               | Un-merges the specified from                                            |
| DetectGlobalMergeCandidates | void                                   | *none*                                                                                                                                              | TODO                                                                    |
| ClearGlobalMergeCanadidates | void                                   | *none*                                                                                                                                              | TODO                                                                    |
| ClearGlobalIgnoreFlags      | void                                   | *none*                                                                                                                                              | TODO                                                                    |
| ClearMergeCandidates        | void                                   | *Guid* **masterKey**                                                                                                                                | Clear all merge candidates                                              |
| ClearIgnoreFlags            | void                                   | *Guid* **masterKey**                                                                                                                                | Clear ignored flags                                                     |
| DetectMergeCandidates       | void                                   | *Guid* **masterKey**                                                                                                                                | Perform the necessary operations to detect merge candidates for         |
| Reset                       | void                                   | <p><em>Guid</em> <strong>masterKey</strong><br><em>Boolean</em> <strong>includeVerified</strong><br><em>Boolean</em> <strong>linksOnly</strong></p> | Reset the specified merge service data on the specified record          |
| Reset                       | void                                   | <p><em>Boolean</em> <strong>includeVerified</strong><br><em>Boolean</em> <strong>linksOnly</strong></p>                                             | Reset the specified merge service data on the specified record          |

## Implementations

### SimResourceInterceptor\<TModel> - (SanteDB.Core.Api)

Single Instance Mode Handler

#### Description

This class binds to startup and enables the listening and merging of records based on the record matcher

{% hint style="info" %}
This service implementation is abstract or is a generic definition. It is intended to be implemented or constructed at runtime from other services and cannot be used directly
{% endhint %}

### MdmEntityMerger\<TEntity> - (SanteDB.Persistence.MDM)

An MDM merger that operates on Entities

#### Description

This class exists to allow callers to interact with the operations in the underlying infrastructure.

{% hint style="info" %}
This service implementation is abstract or is a generic definition. It is intended to be implemented or constructed at runtime from other services and cannot be used directly
{% endhint %}

### MdmResourceMerger\<TModel> - (SanteDB.Persistence.MDM)

An implementation of a IRecordMergeService for an MDM controlled resource

{% hint style="info" %}
This service implementation is abstract or is a generic definition. It is intended to be implemented or constructed at runtime from other services and cannot be used directly
{% endhint %}

\# Example Implementation \`\`\`csharp /// Example Implementation using SanteDB.Core.Services; /// Other usings here public class MyRecordMergingService : SanteDB.Core.Services.IRecordMergingService { public String ServiceName => "My own IRecordMergingService service"; ////// Gets the duplicates for the specified master record ///public IEnumerable GetMergeCandidateKeys(Guid masterKey){ throw new System.NotImplementedException(); } ////// Get merge candidate keys ///public IQueryResultSet GetMergeCandidates(Guid masterKey){ throw new System.NotImplementedException(); } public IQueryResultSet GetGlobalMergeCandidates(){ throw new System.NotImplementedException(); } ////// Gets the ignore list for the specified master record ///public IEnumerable GetIgnoredKeys(Guid masterKey){ throw new System.NotImplementedException(); } ////// Gets the ignore list for the specified master record ///public IQueryResultSet GetIgnored(Guid masterKey){ throw new System.NotImplementedException(); } ////// Indicates that the engine should ignore the specified false positives ///public IdentifiedData Ignore(Guid masterKey,IEnumerable falsePositives){ throw new System.NotImplementedException(); } ////// Indicates that an ignored record should be removed from the ignore list ///public IdentifiedData UnIgnore(Guid masterKey,IEnumerable ignoredKeys){ throw new System.NotImplementedException(); } ////// Merges the specified into ///public RecordMergeResult Merge(Guid masterKey,IEnumerable linkedDuplicates){ throw new System.NotImplementedException(); } ////// Un-merges the specified from ///public RecordMergeResult Unmerge(Guid masterKey,Guid unmergeDuplicateKey){ throw new System.NotImplementedException(); } public void DetectGlobalMergeCandidates(){ throw new System.NotImplementedException(); } public void ClearGlobalMergeCanadidates(){ throw new System.NotImplementedException(); } public void ClearGlobalIgnoreFlags(){ throw new System.NotImplementedException(); } ////// Clear all merge candidates ///public void ClearMergeCandidates(Guid masterKey){ throw new System.NotImplementedException(); } ////// Clear ignored flags ///public void ClearIgnoreFlags(Guid masterKey){ throw new System.NotImplementedException(); } ////// Perform the necessary operations to detect merge candidates for ///public void DetectMergeCandidates(Guid masterKey){ throw new System.NotImplementedException(); } ////// Reset the specified merge service data on the specified record ///public void Reset(Guid masterKey,Boolean includeVerified,Boolean linksOnly){ throw new System.NotImplementedException(); } ////// Reset the specified merge service data on the specified record ///public void Reset(Boolean includeVerified,Boolean linksOnly){ throw new System.NotImplementedException(); } } \`\`\`

## References

* [IRecordMergingService C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Services_IRecordMergingService.htm)
* [SimResourceInterceptor\<TModel> C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Data_Management_SimResourceInterceptor_1.htm)
* [MdmEntityMerger\<TEntity> C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Persistence_MDM_Services_Resources_MdmEntityMerger_1.htm)
* [MdmResourceMerger\<TModel> C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Persistence_MDM_Services_Resources_MdmResourceMerger_1.htm)
