Notes for Oracle Dependency usage.

Source: Internet
Author: User

The client architecture of the wcf server is used in recent projects. The client sends a request to the server to query a table. The wcf server then accesses the server database and returns the result to the client.
There is a problem with this, that is, the client data update. Refreshing is too frequent and performance is affected. OracleDependency is used to solve this problem. When you register an OracleDependency, if the database status you are concerned about changes, the database will send a message to the registration end. In this way, you don't have to refresh constantly. You only need to wait for the notification sent by the database with peace of mind.
In my project, my wcf Server communicates with the client in duplex mode. When the client connects to the wcf server, a callback function is registered to the wcf server. When the client sends a query to a table, the wcf server uses OracleDependency to subscribe to this query on the database server. If the status of the concerned database changes, the database notifies the wcf server, the wcf server then notifies the client through the callback function of the client. I will not talk much about wcf. I just want to talk about OracleDependency. This is because there is less information on the Internet.
Pay attention to the following issues when using OracleDependency.
0. What can OracleDependency detect?
Data or database status.
1. Why can't I receive notifications from the server sometimes?
This is because it is not saved when you generate an OracleDependency object. If it is just a local variable, it will be recycled, and the time for recycling is not fixed. Once recycled, the notification cannot be received.
2. If you have registered an OracleDependency, must you cancel the registration?
Yes, if you don't cancel it, you will always send a message. Even if your OracleDependency object is destructed, you cannot cancel registration on the database server. This has a great impact on the database server.
3. How to cancel OracleDependency registration?
When you initialize, there are several parameters. One is whether to listen for changes only once. If this value is set to true, when you receive an event notification, the database automatically cancels the registration. Another initialization parameter is to set the validity period of registration. When the time is reached, the database server will also cancel registration. If you select to listen multiple times during initialization and set the time to 0 (permanently valid), you must explicitly call RemoveDependency () in your program () this function is used to cancel registration.
4. When should I use OracleDependency?
When the database status is not frequently changed.

Go to Dangdang to buy books at a lower price and deliver them to the door.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.