Skip to content

BulkMerge Not Update the values #827

Closed
@mohammdemara

Description

@mohammdemara

I have One Entity have 3 child and using bulk merge function it works fine if the record new but if on the row is updated not updating the values on db below is the code sample . Please guide what is missed here or what is the issue on this code .

                    await _context.BulkMergeAsync(patientsToMerge, options =>
                    {
                        
                        options.IncludeGraph = true;
                        //options.UpdateMatchedAndConditionExpression = x => new { x.ModifiedDate };
                        options.IncludeGraphOperationBuilder = operation =>
                        {
                            switch (operation)
                            {
                                case BulkOperation<Patient> patient:
                                    //patient.InsertIfNotExists = true;
                                    patient.ColumnPrimaryKeyExpression = x => x.nationalId;
                                    patient.AutoMapOutputDirection = true;
                                    patient.AllowDuplicateKeys = true;
                                  
                                    break;
                                case BulkOperation<Domain.Entities.Authorization> authorization:
                                   // authorization.InsertIfNotExists = true;
                                    authorization.ColumnPrimaryKeyExpression = x => x.requestNumber;
                                    authorization.AutoMapOutputDirection = true;
                                    authorization.AllowDuplicateKeys = true;
                                   

                                    break;
                                case BulkOperation<Service> service:
                                  //  service.InsertIfNotExists = true;
                                    service.ColumnPrimaryKeyExpression = x => x.Id;
                                    service.AutoMapOutputDirection = true;
                                   service.AllowDuplicateKeys = true;

                                    break;
                                case BulkOperation<Domain.Entities.Log> log:
                                   // log.InsertIfNotExists = true;
                                    log.ColumnPrimaryKeyExpression = x => x.Id;
                                    log.AutoMapOutputDirection = true;
                                    log.AllowDuplicateKeys = true;
                                    //   log.
                                    break;

                            }


                        };
                    }); 

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions