我有一个 WCF REST 服务。我想为操作编写集成测试。我正在考虑使用 HttpWebRequest 来编写这些内容(如 Why does my C# client, POSTing to my WCF REST service, return (400) Bad Request? 中所述)。
我的问题是:我可以将 HttpWebRequest 代码放在事务范围内,以便在执行后回滚任何数据库操作,例如:
using (var scope = new TransactionScope(TransactionScopeOption.Required))
{
// use HttpWebRequest to execute REST service operation
}
这行得通吗?
最佳答案
REST 不支持将事务从客户端传播到服务。
关于c# - Transactionscope 和 webHttpBinding,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8388486/