SteveFossey
(Steve Fossey)
September 27, 2023, 5:58pm
1
Hey all, this is strange - I’ve scoured the docs and this forum and haven’t found what I’m missing.
I’m on 2021.2.
This compiles without error but if I uncomment the line where I call the function, I get the error in the topic.
var restClient = new RestClientBuilder();
restClient.UseSession(this.oTrans.CoreSession);
restClient.Build();
var efxContent = new RestContent(
new{
strReqGroup = group,
});
//var efxResponse = restClient.Function.Post("FleetSolutions", "CreateGroup", efxContent, published: true);
Any thoughts? I’m fairly sure I have my references and usings correct.
SteveFossey
(Steve Fossey)
September 28, 2023, 12:04pm
2
Update, no go. I’ve removed and replaced the assembly reference to Epicor.Ice.Lib.RestClient.
At this point I’m considering @klincecum 's FunctionRunner idea, or maybe use RestSharp instead? I was hoping to keep it simple…
Is there any way to view what RestClientBuilder DOES have? Short of decompiling?
klincecum
(Kevin Lincecum)
September 28, 2023, 12:22pm
3
This looks correct to me.
SteveFossey
(Steve Fossey)
September 28, 2023, 12:36pm
4
Decompiled and added what appear to be missing references:
“Build()” appears to build:
And what it builds appears to have “Function” although I’m kind of in new territory for a 90s script kiddie
And that, in turn, appears to do and have what I’d expect
but no change.
The whole error FWIW and FFS (“for future searches”, obviously; what were you thinking?) is:
" Error: CS1061 - line 166 (278) - ‘Ice.Lib.RestClient.RestClientBuilder’ does not contain a definition for ‘Function’ and no extension method ‘Function’ accepting a first argument of type ‘Ice.Lib.RestClient.RestClientBuilder’ could be found (are you missing a using directive or an assembly reference?)"
Olga
(Olga Klimova)
September 28, 2023, 12:45pm
5
you need to assign the result of Build to your varible, not the builder itslef.
var restClient = new RestClientBuilder().
UseSession(this.oTrans.CoreSession).
Build();
1 Like
SteveFossey
(Steve Fossey)
September 28, 2023, 1:18pm
6
you have GOT to be kidding me
@Olga I know you get embarrassed when we call you a genius so I won’t say it, I’ll just say I’m an idiot and that should average it out.
Thank you THANK you thank you!
1 Like
klincecum
(Kevin Lincecum)
September 28, 2023, 1:24pm
7
Ok, I’ll just say that @Olga has great attention to detail then
2 Likes