Skip to content

Commit

Permalink
Merge pull request #134 from MarkMpn/type-conversion
Browse files Browse the repository at this point in the history
Type Conversion Fix
  • Loading branch information
MarkMpn authored Dec 1, 2021
2 parents 6c383d8 + c8cdd35 commit 9702d47
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions MarkMpn.Sql4Cds.Engine/ExecutionPlanBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,12 @@ attr is LookupAttributeMetadata lookupAttr &&
var attr = attributes[colName];
targetName = attr.LogicalName;
targetType = attr.GetAttributeSqlType();

// If we're inserting into a lookup field, the field type will be a SqlEntityReference. Change this to
// a SqlGuid so we can accept any guid values, including from TDS endpoint where SqlEntityReference
// values will not be available
if (targetType == typeof(SqlEntityReference))
targetType = typeof(SqlGuid);
}

if (!schema.ContainsColumn(sourceColumns[i], out var sourceColumn))
Expand Down
1 change: 1 addition & 0 deletions MarkMpn.Sql4Cds.Engine/MarkMpn.Sql4Cds.Engine.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<description>Convert SQL queries to FetchXml and execute them against Dataverse / D365</description>
<summary>Convert SQL queries to FetchXml and execute them against Dataverse / D365</summary>
<releaseNotes>Fixed decimal number handling with non-English regional settings
Fixed "No explicit conversion exists" error when using guid string literals
</releaseNotes>
<copyright>Copyright © 2020 Mark Carrington</copyright>
<language>en-GB</language>
Expand Down
1 change: 1 addition & 0 deletions MarkMpn.Sql4Cds/MarkMpn.SQL4CDS.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Using the preview TDS Endpoint, SELECT queries can also be run that aren't conve
<summary>Convert SQL queries to FetchXML and execute them against Dataverse / D365</summary>
<releaseNotes>Fixed decimal number handling with non-English regional settings
Added missing comma in generated M query
Fixed "No explicit conversion exists" error when using guid string literals
</releaseNotes>
<copyright>Copyright © 2019 Mark Carrington</copyright>
<language>en-GB</language>
Expand Down

0 comments on commit 9702d47

Please sign in to comment.