Notify changes from generic database to WPF application [closed] - c#

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 8 years ago.
Improve this question
Like in the title, I need to notify to my C# WPF application any changes in the database (there is another app adding data in one table).
I'm using Entity Framework and Linq. The dbms can be different (SQL Server, Oracle, MySQL,...).
I am reading a lot about this and I ask it also here: is there a way yo reach this goal without using polling?

I hope the following link might help you, especially the answer for Event Notifications & Sql server's CLR objects(comments on Redis etc tools) for SQL Server but this may be limited to one or two databases:
MsSQL callback function to asp.net website
For Oracle database, the ODP has similar notification mechanism:
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/changenotification/ChangeNotification.htm
And since the EF providers are different for SQL & Oracle and with very less support for other database, you can have hosted service etc., listening to change notifications and publishing data change event so that the subscriber can take appropriate action like refreshing context or updating cache etc.

Related

ASP.NET Core Web API multi database in app [closed]

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 1 year ago.
Improve this question
I currently work to develop POS (Point of Sales) based on ASP.NET Core and I am using Entity Framework Core.
What I need is create separate account for each institution that will be use our POS system at same time create its own database (customer database) dynamically (migration in EFC).
Finally when user (or institution) logs in, I have to verify the customer's account and link it with their database.
What is the framework that I need to get this job done?
I had a similar problem with you before, except that my software was connected to distributed database. In this case, I used the dynamic unit of work and the repository pattern. Also, to create a connection string for connect to each database, I kept them in another central database, and also in the dynamic unit of work you can create the dynamic repository of each database automatically and connect to the relevant database by receiving the connection string. You can also see the sample here, but you must to change repositroy and unit of work to generic mode.

C# How to: listening if new record is inserted in a mysql table [closed]

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 5 years ago.
Improve this question
I would like to create an event in c# that it triggers when a new record is inserted in a mysql table. I want to avoid to do polling the table every time.
Do you think it is possible?
Thanks in advance
A DBMS such as MySQL is a multi user system, as such then only the database itself knows when data is inserted.
MySQL supports triggers which allow you to perform an action when some data is read, inserted, updated, deleted from a table.
Typically this is done to perform a similar action upon other tables in the system, but MySQL does support a feature known as UDF - User Defined Functions which will allow you to call external programs from the trigger.
I have not done this myself and only know the theory, but if you search for UDF for MySQL then I'm sure you can find some examples.
Here are some examples:
http://crazytechthoughts.blogspot.de/2011/12/call-external-program-from-mysql.html
Calling an url from a trigger in mysql
You can then use this to interact with your program. But be careful with performance as the trigger is called synchronously.
It might be an idea to get the trigger to send a message via message bus, which you program can then listen for.

Synchronization of data between web & C# [closed]

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
I have created a web system to display a timetable of teachers.
Teachers have a desktop application (used C#) in their laptops with the same system as web system.
THE CASE IS;
- When the teachers connect to Internet they can fetch the timetables allocated for them.
- Teachers are allowed edit the timetable using their desktop application.
- They must have the ability to sync it to the web system when Internet connection is there.
PROBLEMS:
- I have no idea about how to sync these updated data to the online database.
- How can I temporarily store the fetched , and (or) edited data in the desktop application without creating a temporary database?
- Is there any technology/ plugin to do this task easily?
IMHO, the best option would be to have a local store that can store the application data and sync up with the server whenever the internet connection is working.
The mode would be a database, however, a secure file system also sounds fine.
There is a great deal of thought process involved with using the offline sync model. There should be a conflict check with the server before any data gets overridden to the db. Also, the client app should not loose data between restarts.
I would suggest that you decide on the right approach to sync data, prepare and review the process and consider Various algorithm's for the sync. In case of any specific questions, please post your questions here.

Database approach for an offline C# WPF application [closed]

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
I need to develop a standalone windows application that will work offline. I have decided to implement it using C# and WPF.
However because the application database should be able to run without having to install Sql Server on the client's desktop, am not sure what's the best approach.
The concept is that i will develop the application give the executable to the client, install and run the application without any complexity of connecting database.
So far i am considering to use SQLite.
My question is what's the best solution to connect a database within the application.
SqlLite is the best option to go so as to have both the sql features
and also a offline db.
If the data is very, very simple, and you need
it to be readable by other applications or users (with appropriate
permissions), I would probably choose to store it in an XML file or
even a plain-text file inside the user's Application Data folder,
which would be obtained via Environment.GetFolderPath.
If you want to store files such as images,etc then you should go for
IsolatedStorage.
Use EntityFramework to connect to SQLite, my preference is always to use the code-first database so everythings managed from your C# code, I believe EF can be modified to implement INotifyPropertyChanged on your behalf which will help setting up your bindings in WPF.
XML shouldn't be used for anything except for configuration IMHO, it will soon be deprecated in favour of JSON, I'm sure of it, not that that really affects you.

make application responsive and fast [closed]

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 created a wpf browser application ,and I hosted it in a live server ,it is a Inventory Management application ,which uses database heavily for saving, updating and selecting data.On save and select operation it takes very long time to save and fetch data to and from database.In the meantime (when save or select data from database) the application is irresponsive .How to make the application fast when dealing with database and how to make the application responsive during that operation .I am totally messed up ,its very kind if anyone has the answer .
Is using stored procedures instead of raw sql bring performance or not?
Edit
My application interact with database by using raw sql statements.
Responsive Application
In order to make your application responsive you need to make every interaction with the database in a new thread or task. You could also use the new C# 5.0 features await and async.
Your current application is blocking because the main thread is handling database operations as well as user interface, so what you need to do is to handle these two separate functionalities in separate threads.
Fast Database Access
I don't know how are you dealing with the database right now, but you could definitely use some kind of ORM like Entity Framework or NHibernate.
For better performance, but much less readable and mantainable code, which is really important, you could use raw sql.
try this
to access DB faster in .NEt i am sure it not problem with c# but for querying and retireving DB u need to have better mechanism

Categories