Question

Can I register a .Net COM class with the SingleUse-flag?

The reason I want to use SingleUse is that otherwise the static fields inside the COM instances (the client application uses 2 instances with different database connection strings) are shared resulting in any COM instance to access the same database.

Was it helpful?

Solution

No, this doesn't go in the registry. It is a property of an out-of-process COM server, used when it registers its class factories. The dwClsContext argument for CoRegisterClassObject().

Using static fields is your mistake. Easy to fix.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top