I get the dreadful "Unspecified error" all of a sudden when combining
ServiceDomain and ServicedComponent in NET 1.1. This worked before; does
anyone know or have the same problem?
ServiceDomain.Enter(cfg) in this example works fine if not called from a
ServicedComponent.
Example:
[Transaction(TransactionOption.Required)]
public class MyProcessor : ServicedComponent
{
public MyProcessor () {}
[AutoComplete]
public void Execute(...) {
DataManager mgr = new DataManager();
mgr.Save(...);
}
}
public class DataManager() {
// Nontransactional
public ... Load(...) { ... }
// Transactional
public void Save(...) {
// Enure we are in transaction
using (TransactionScope scope = new
TransactionScope(TransactionOption.Required)) {
...
scope.Complete();
}
}
}
public class TransactionScope : IDisposable {
private bool _complete;
public TransactionScope(TransactionOption option) {
ServiceConfig cfg = new ServiceConfig();
cfg.Transaction = option;
ServiceDomain.Enter(cfg); // Boom, unspecified error
}
public void Complete() {
_complete = true;
}
public void Dispose() {
if (_complete)
ContextUtil.SetComplete();
else
ContextUtil.SetAbort();
ServiceDomain.Leave();
}
}
===================================
This list is hosted by DevelopMentorĀ® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com