如何使PostgreSQL触发和C#Windows服务一起工作? [英] How to make PostgreSQL trigger and C# Windows Service work together?

查看:184
本文介绍了如何使PostgreSQL触发和C#Windows服务一起工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个Windows服务在C#中,将等待在特定表的变化PostgreSQL数据库,然后根据从最后插入的行中的数据进行操作。 据我所知,(我是新来的Pos​​tgreSQL)我可以使用触发器来执行结构性code函数 - 但是如何让它将数据传递给我的服务?

I want to write a windows service in C# that will wait for a change in the particular table in PostgreSQL database and then operate based on the data from the last inserted row. As far as I know (I'm new to PostgreSQL) I can use triggers to execute a function in structural code - but how to make it pass the data to my service?

在此先感谢您的任何建议。

Thanks in advance for any suggestions.

推荐答案

看异步通知 - 的 http://www.postgresql.org/docs/8.4/static/sql-notify.html 。从触发器内NOTIFY,有服务不侦听它把火关通知的通知后,连接和行为。

Look at asynchronous notifications - http://www.postgresql.org/docs/8.4/static/sql-notify.html. Fire off a notification with NOTIFY from inside the trigger, have the service do LISTEN on it's connection and act upon the notification.

这篇关于如何使PostgreSQL触发和C#Windows服务一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆