-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added new virtual field "OrderIntegrationOrderId", so when we import … #35
Conversation
…orderlines we can make a lookup on the EcomOrders to fetch the OrderId and place it in the OrderLineOrderId column. Uptimized AddMappingsThatNeedsToBeThereForMoveToMainTables and RemoveColumnMappingsThatShouldBeSkippedInMoveToMainTables so they are triggered for all mappings and not just the first.
src/OrderProvider.cs
Outdated
var OrderCustomerAccessUserExternalIdMapping = columnMappings.Find(cm => string.Compare(cm.DestinationColumn.Name, OrderCustomerAccessUserExternalId, true) == 0); | ||
if (OrderCustomerAccessUserExternalIdMapping != null && OrderCustomerAccessUserExternalIdMapping.SourceColumn != null) | ||
_existingOrders = []; | ||
SqlDataAdapter ordersDataAdapter = new("select OrderId, OrderIntegrationOrderId from EcomOrders ", Connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add WHERE clause for filtering out the null or empty IntegrationOrderIds that are not needed, also maybe you can GroupBy IntegrationOrderId so you don't then need to check if _existingOrders.ContainsKey
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DWDBE I am not sure if GROUP BY in SQL is good enough, as it needs both SELECT columns in it for it to work
and then it still is able to return multiple "same" values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could change the "Hashtable _existingOrders" to a Dictionary<string, string> and do a TryAdd() instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can try with just one column in grouping: "GroupBy OrderIntegrationOrderId"
yes, try with Dictionary<string, string>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DWDBE I've changed the Hashtables to Dictionary<string, string>, but can not do the GROUP BY of just one of the selected columns (see picture above, as SQL Manager fails)
…> so get functions can use .TryAdd logic
…orderlines we can make a lookup on the EcomOrders to fetch the OrderId and place it in the OrderLineOrderId column. Uptimized AddMappingsThatNeedsToBeThereForMoveToMainTables and RemoveColumnMappingsThatShouldBeSkippedInMoveToMainTables so they are triggered for all mappings and not just the first.