Referencing between Two Projects
I have one using WPF and another using ASP.NET Web api.
Now I am running the server from wpf project, so i created a reference in it pointing to the server.
So do i have an approach to use the classes and methods placed in wpf when the server received requests,
Or i should create a shared project
5 Replies
What should I do?
What are you trying to do?
A WPF app should not directly reference a server. A server by definition should be separate and should be capable of running on a separate machine.
If you are using a webapi, then your wpf app is the client which sends requests to the server. E.g., the wpf app can send a login request, or some Get data request.
I'm not sure whether it is possible to send requests the other way round with webapi - server to client.
However you could from time to time send a "Any tasks for me?" request to the server
With gRPC you can use bidirectional streaming. A client can connect to a server and continuously recoeve a stream of messages, e.g., notifications
I once came up an idea: I can use a RESTful API to help 3rd party apps to check my app's status, and use it to post notifications.
GitHub
GitHub - laipuran/Gear: A PPT classifier tool for class and a tool ...
A PPT classifier tool for class and a tool for notifying. - GitHub - laipuran/Gear: A PPT classifier tool for class and a tool for notifying.
So I created a aspnet web api project as the "server" I mentioned, and i expect to use it to do the things described in the previous replies.
@Denis
I have already known the concept of "Dependence Inversion Principle"
Problem solved. I'll add a service layer.