You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
I am not sure if the framework support the scenario of using anUpsertRequest And KeyAttributeCollection of Composite Keys.
I have tried to implement to test it, but I got a full load of duplicates. Was not sure if it was my code, or the scenario I am using is unsupported. My code below:
var MyMetadata = new Microsoft.Xrm.Sdk.Metadata.EntityMetadata();
DAMetadata.LogicalName = new_testEntity.EntityLogicalName;
var alternateKeyMetadata = new Microsoft.Xrm.Sdk.Metadata.EntityKeyMetadata
{
KeyAttributes = new string[] { "new_mobilenumber", "new_birthdate" }
};
MyMetadata.SetFieldValue("_keys", new Microsoft.Xrm.Sdk.Metadata.EntityKeyMetadata[]
{
alternateKeyMetadata
});
var context = new XrmFakedContext();
context.Initialize(entities);
context.InitializeMetadata(DAMetadata);
Please advise
The text was updated successfully, but these errors were encountered:
Hello @michaelfsarkis,
the framework support for Alternate Key is limited at the "retrieval" of the data (internally it converts the Alternate Key to the record GUID), but it does not yet support an uniqueness check. I am not sure if the uniqueness check is what you mean with I got a full load of duplicates. It does support composite keys too.
Yes, I meant uniqueness check. When calling the UpsertRequest, and passing Alternate key, I was expecting the framework to update existing record (with the same key values), instead of creating duplicate record (with similar key values).
I understand now that Composite keys are supported but uniqueness check is not yet.
Does framework support "UpsertRequest" for uniqueness check if I used EntityId (Guid) instead of Alternate Key?
Can you please provide a sample unit test of what you are trying to achieve?
As I mentioned the framework supports the "retrieval" of data (for the UpsertRequest it is implemented here) so if the test is setup correctly it should not duplicate record but update existing ones.
Hi,
I am not sure if the framework support the scenario of using anUpsertRequest And KeyAttributeCollection of Composite Keys.
I have tried to implement to test it, but I got a full load of duplicates. Was not sure if it was my code, or the scenario I am using is unsupported. My code below:
Please advise
The text was updated successfully, but these errors were encountered: