Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Problem:
I have an instance of an application on one computer (C# VS 2015), it is connected to a database (SQL).
I have other instances of the same application on other computers.
All computers are connected, and all instances are working with the same database.
When the software writes into the database, the UI will change accordingly.
Question:
How to I refresh the UI of EVERY instance when any machine changes the database?
Example:
Clicking buttonA:
1. Create record in database.
2. Change buttonA background color to green.
3. Tell other computers to refresh their instances to show their buttonA as green too.
Hope this wasn't a stupid question, I appreciate all help!
This is not a stupid question, but rather a very common requirement. The best solution (in my opinion) would be to create a WCF service all clients talk to.
Only the service performs operations on the database and is designed as a two-way service. That way, once a client is connected, the service can instruct it to refresh itself if another client changed something. No client would change the database itself.
If that isn't possible, I'm afraid polling the database for changes is the only common option that works for any RDBMS. There may be other options for the RDBMS you're using.
How fast do you need to refresh? If you have some seconds, then I would suggest to use a polling approach: just query the database every x seconds, for all records updated after the previous poll.
The returned records are those to be refreshed in the UI. Indexing that datetime field would help to minimize the impact of frequent/multiple queries.
If you have a web based UI then something like SignalR would do this for you. I've used this before and it works great.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm working on a small WPF Project. The data is being stored on Server machine. I want, that the clients can access that database by a WPF Software. The connection is only LAN. Any idea, how to develop my WPF APP further? Perhaps WCF? any book or any quelle that can help me specific with this topic?
thanks guys!
It depends on how your application will be used.
From a WPF application you can connect directly to your database and it is the easiest way but, not allways the best.
If your application will be used only on internal network, you can use SQL Connection, an ORM like Entity Framework etc.
But, if you want to use your application externally, I mean for exemple at home, you will need to open the TCP/IP Port on your Database Server in order to be able to connect from your application using SQLConnection. This is not difficult but will make your server vulnerable against hacker attacks. In this case, you can use a web service to publish on your server and consume it in order to communicate with your db. The disadvantage of this is the development time. Ofcourse developing a web service and consuming it will take more time to develop than connecting directly via an SQLConnection.
For me, you must choose the most optimised for your case.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I want to stress my .net web service, It feels like something is limiting the concurrent connections I can have.. even when trying from 2 different computers on them server the results were pretty the same. (All of this is done locally, server and clients are on local network so response time is very fast)
So is there a settings I need to change in my server machine to allow more incoming connections?
There are various things that can limit the amount of processing possible, each of which require research to see if they apply. So you might want to add more to your question about what has been verified today.
Regardless, based on your information I would assume that SessionState is enabled. This, with default behavior will limit processing to a single request at a time for each client due to synchronization locks for guaranteed read-write ability. I assume this is the root cause of what you are seeing today. This StackOverflow post talks about this specifically
Others have posted various details in the comments that can help also.
I have found though that load testing is best done from outside sources as well to ensure your entire production pipeline is involved. (Network components, etc)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to somehow notify a running process from the "outside"?
I have a C# program that theoretical runs forever. And I would like to notify it to trigger some action manually. It would be best, if this solution is possible on Windows and Linux (mono).
EDIT:
The solution should work without a user interface
My program is, as for now, a part of web service. On initializing, a new Theread is created, which uses the Task class to stay alive
Take your forever-running-process and let it provide a webservice other processes can call.
You might use any cross-plattform webservice framework like WebApi or ServiceStack to achieve this via HTTP calls. This will even work over the internet (if the machines can reach each other).
There are dozens of approaches. You could also use named pipes for example, or put commands into a database (the other process has to query regularly) or - if you're fearless enough - write/read files to communicate. Be creative ...
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm developing my financial app for simple operations. But I need to be able to make note of any changes made to my records. I use C# ASP.NET for my application code and MS SQL 2014 for my DB.
My question is: which is better ?
Application Layer: write a method in code that creates a record in a history table in DB?
Database Layer: write trigger/procedure that creates a record in a history table in DB ?
My main concern is performance - the app is mounted on a IIS server in my home so i need to fine tune this so it will be lag-less for my users and doesn't put a big workload on my server.
This has a lot to do with preferences and maintainability.
For the sake of maintainability, I always go with the Layered approach, myself.
Here's an example why.
Let's say you have your SQL Inserts and updates scattered throughout the code. And then, one day, your database changes in such a way, that you would have to look up each and every one of those inserts and updates, and change all of them one by one.
For the sake of argument, you could also create one function that does all of these inserts and updates, and call that specific function every time from your app. That would work, but could become a clutter as you'll eventually end up with a lot of those functions for different tables, views, etc, ...
Now let's say you have used the layered approach. You would then simply find the class that does all updates and inserts to one specific table and simply do your changes there. The rest of the application perhaps doesn't even need to be aware of this change.
Performance is (in my opinion) not really a factor. Making an object isn't expensive at all, but is hardly measurably as it is. So I'd say go with the layered approach.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am looking to change the current architecture of distributed winforms application developed using TCP messages and the client talks to database directly. I know this a bad design and I am entrusted to change this. I have been recruited for the same.
Bit of Overview:
Client uses Winforms applications
Client loads the initial data from database directly
Clients listens to the Server (Winforms application with TCP listener)
If an update is made in an any of the entity, client will update the database directly and sends the message to server, which in turn send the information to other clients. Then these clients would refresh the data from database
Technologies Used: VB.NET, Entity framework, Oracle Database and TCP Listener.
I need all your advise about what would be best solution/architecture for the same. I thinking about using WCF with duplex communications for messages.
Thank you in advance for your replies.
Use a simple WinForms (or WPF if you can) client, WCF server, EntityFramework for ORM and Oracle for DB.
The client calls the server. the server uses EF to call the DB. This 3 tier design is pretty common and basic. What's wrong with it?
PS: I would recommend against using duplex communication because it's over complicated and doesn't always work. What is your specific need for it?