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
We are utilizing the latest version of this library very heavily without any issues at all so it's been great. We are in need of executing a function and need to specify a function parameter in a very specific format.
The function requires a parameter of Target=@tgt (@tgt can be anything) but there must be NO quotes at all.
If I run use the following code: client.For<SystemUser>.Key(userGuid).Function("RetrievePrincipalAccess").Set(new { Target = "@tgt })
the library will generate a URL as follows: https://server/api/data/systemusers(userGuid)/Microsoft.Dynamics.CRM.RetrievePrincipalAccess(Target='@tgt')
when it needs to be: https://server/api/data/systemusers(userGuid)/Microsoft.Dynamics.CRM.RetrievePrincipalAccess(Target=@tgt)
Is there any way to remove the single quotes the Set() is adding to my URL?
I was able to get this working by using the BuildRequestFor() and modifying the RequestUri directly, but I am unable to write proper unit tests since the ODataRequest has only internal constructors and is un-mockable.
The text was updated successfully, but these errors were encountered:
I ran into the same issue, the following solved it for me (though it would be nice of they supported a SerializationOption for the key to control this behavior):
publicclassAbstractApi(HttpClienthttpClient,UrirelativeUri):ODataClient(newODataClientSettings(httpClient,relativeUri){IgnoreUnmappedProperties=true,BeforeRequest= m =>m.RequestUri=m.RequestUri.RemoveUnsupportedQuotes()});
public staticclass AbstractApiExtensions
{publicstaticUri?RemoveUnsupportedQuotes(thisUri?uri){if(uri==null){returnuri;}varnewUri=uri.ToString();newUri=newUri.Replace("(%27","(");newUri=newUri.Replace("%27)",")");returnnewUri(newUri);}}
Hello,
We are utilizing the latest version of this library very heavily without any issues at all so it's been great. We are in need of executing a function and need to specify a function parameter in a very specific format.
The function requires a parameter of
Target=@tgt
(@tgt
can be anything) but there must be NO quotes at all.If I run use the following code:
client.For<SystemUser>.Key(userGuid).Function("RetrievePrincipalAccess").Set(new { Target = "@tgt })
the library will generate a URL as follows:
https://server/api/data/systemusers(userGuid)/Microsoft.Dynamics.CRM.RetrievePrincipalAccess(Target='@tgt')
when it needs to be:
https://server/api/data/systemusers(userGuid)/Microsoft.Dynamics.CRM.RetrievePrincipalAccess(Target=@tgt)
Is there any way to remove the single quotes the Set() is adding to my URL?
I was able to get this working by using the BuildRequestFor() and modifying the RequestUri directly, but I am unable to write proper unit tests since the ODataRequest has only internal constructors and is un-mockable.
The text was updated successfully, but these errors were encountered: