Base solution for your next web application
Open Closed

Utility Method #8666


User avatar
0
mahendra created

Hi,

How can a pull a method defined in AppService to my typescript. Lets say there is a method called "Calculate" in my AppService. The method takes an input parameter of DTO or List of DTO and returns the DTO or single value. Inside the method body, no there DTO or SQL or anything else is referenced. It only calculate on the values passed in as input parameter and then returns same DTO by setting some value in the same DTO. I want to use this calculate method at client side as well as server side.

If I write that method as a normal AppService method, then though it will get generated in my proxies at the client side (using refresh.bat), but when I'll use this method at the client side, it will actually make a server call which I want to avoid. How can I acheive this.

Basically I want a utility function written at AppService (or may be somewhere else in the server) to be replicated at client side so that I write once and it can be used at both the places (i.e. server as well as client) without making a service call from client.

Regards, Mahendra


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    I think this is almost impossible, you should implement this method in typescript rather than in application services.

    It is difficult to translate c# methods into typescript. I do not know what the tool can do this.