XrmCoreLibrary icon indicating copy to clipboard operation
XrmCoreLibrary copied to clipboard

updated to use the new DataverseClient and targeting .net standard 2.0

Open mohsinonxrm opened this issue 4 years ago • 10 comments

mohsinonxrm avatar Nov 06 '21 19:11 mohsinonxrm

@seanmcne , please review and merge and publish the nuget package.

mohsinonxrm avatar Nov 06 '21 19:11 mohsinonxrm

@seanmcne , any thoughts?

mohsinonxrm avatar Jan 26 '22 01:01 mohsinonxrm

@mohsinonxrm were you able to verify all the tests work? I also have a dataverse compatible build of this but i haven't pushed it to github yet (originally I was waiting for some changes to land). One other thing I had done was copied the previous v9 version into a 9.2 folder, committed that, then did my updates so I can get history - leaves me somewhat regretting the version specific folder structure :)

seanmcne avatar Jan 26 '22 19:01 seanmcne

@seanmcne , I can't remember about the test results. I'll run them again and update here. I actually did the same, I created a new folder for v9.2, kept the structure. BTW, this is just a straight replace of CrmServiceClient with CDS/Dataverse ServiceClient, and now it targets .net standard 2.0, so users can use in .net framework or dotnet core projects.

Anyway, I'll review the test and update here with the results.

mohsinonxrm avatar Jan 29 '22 22:01 mohsinonxrm

I'm curious how you're finding faults to work - I've been running some fault exception tests which aren't working quite right (due to the usage of OrganizationServiceFaults before). I'm still digging in on this - I suspect it will have to be shifted over to DataverseOperationException i'll do some picking away at what I've got here and see if I can get it wired up well enough to function.

seanmcne avatar Feb 23 '22 23:02 seanmcne

As far as I can tell, exceptions are working fine. I am getting exceptions back from the Execute method in the handler, I will test more however, what are you running into?

mohsinonxrm avatar Feb 24 '22 16:02 mohsinonxrm

@seanmcne , can you push your new branch as well? I'd like to review your test cases

mohsinonxrm avatar Mar 03 '22 21:03 mohsinonxrm

Give this test a try - this should produce a DataverseOperationException which was not handled when I ran the test on my end - I adjusted everything to handle both faultExceptions and DataverseOperationException's which appears to work.

 public void ParallelProxy_CreateWithExceptionsTest()
        {
            int targetCount = 3;
            int errorCount = 0;
            var createTargets = new List<Entity>(targetCount);

            for (var i = 0; i < targetCount; i++)
            {
                var target = new Entity("account");
                target["error_name"] = String.Format("Test #{0}", i);

                createTargets.Add(target);
            }

            try
            {
                var createResponses = this.OrganizationManager.ParallelProxy.Create(createTargets, (e, ex) => { errorCount++; });

                Assert.AreEqual(0, createResponses.Count(), "Create responses should be 0.");
                Assert.AreEqual(createTargets.Count, errorCount, "Error count should equal create target count.");
            }
            catch (AggregateException ex)
            {
                Assert.Fail("Error handling approach should not throw an exception: {0}", ex.InnerExceptions.Count > 0 ? ex.InnerExceptions[0].Message : ex.Message);
            }
        }

seanmcne avatar Mar 04 '22 15:03 seanmcne

@seanmcne , you're right. It fails the test. DataverseOperationException is of course new.

How would you like to proceed with this PR? do you want to merge this and add your changes/fixes?

OR

you can paste your catch block here and I can add it to the PR.

mohsinonxrm avatar Apr 13 '22 23:04 mohsinonxrm

@seanmcne - any update on releasing the version compatible with the .net core sdk.

Thanks.

sabrish avatar Jan 18 '23 16:01 sabrish