I need to copy a resource collection to another
Registry.copy method works perfectly for this
Now I've to implement a kind of merge and i'm dealing with this constraint :
Only the new properties must be copied from source to target
Is it possible handle this condition using Handler ?
Yes, You can do this using a handler. please refer below sample media type handlers available in greg(carbon-registry)
WSDLMediaTypeHandler.java
SwaggerMediaTypeHandler.java
WADLMediaTypeHandler.java
Please find this useful article which will teach you how to create a simple handler.
Related
I am building a .Net Profiler for some custom requirement where I need to capture the exception details even though it got handled properly in the code.
To do so-
I have implemented ICorProfilerCallback
SetEventsMask for COR_PRF_MONITOR_EXCEPTIONS
Implemented the ExceptionThrown callback
So far so good, I am getting callback for every exception being thrown. However, it gives OjbectID that is a pointer to the actual exception object. I want more details like the message, call stack, etc. about the exception.
How do I get object details from ObjectID?
As #HansPassant mentioned, what you are doing smells like a debugger feature more than a profiler. However, you can do what you want using the profiler if that is a hard requirement - I believe IL re-writing is possible via the ICorDebug interfaces, but I am a profiler dev and haven't used the debugger interfaces as much.
David Broman's blog has a great description of taking a managed stack walk using the ICorProfilerInfo2 interface. In order to get the native parts you need to do a lot more work.
Navigating the object instance is also done via the ICorProfilerInfo2 interface.
Get the class ID of the object using ICorProfilerInfo::GetClassFromObject()
Using the class ID get the class layout via ICorProfilerInfo2::GetClassLayout()
You will need to parse the object metadata to determine which field you want.
Index into the object to grab the desired data.
This question is a follow up to my previous question, DryIOC Decorator and InResolutionScopeOf
What I'm trying to do is create EF DbContext instances in the resolution scope of both IAsyncRequestHandler and IAsyncNotificationHandler, meaning the context injected in a request can't be the same as one injected in a notification (published from a request). Since the notifications are published from inside the request handlers, this nesting is creating some troubles with my desired setup.
It is worth noting that each DbContext injected in a given IAsyncRequestHandler or IAsyncNotificationHandler instance needs to be the same across their own decorators.
I've created a dotnetfiddle with my attempt at setting this up https://dotnetfiddle.net/KiFCHY. (I've ommitted decorators in this example)
It contains a RequestHandler which prints a message when it is called, and it then publishes a notification, which prints another message. However, as you can see, the notification isn't called because MediatR cannot get the IAsyncNotificationHandler instance (because it can't resolve the DbContext).
Is this setup possible?
Thanks
Found the root cause: ResolveMany<object>(serviceType) which is used in MediatR setup.
An object identifies that you need to pass run-time required serviceType. But DryIoc has an issue of using service type object instead of required type to find the matching resolution scope. And an object is definitely not assignable to IAsyncNotificationHandler<T>.
Here is the modified fiddle
Stay tuned for the fix. I will update my answer with the fix version.
Updated with fix version
The fix is released with DryIoc 2.9.2. Here is fiddle which uses it. Thanks for asking and surfacing 2 issues - real use cases matter the most.
How do you get a pointer to an existing COM object that has been created on the same machine, in a different process?
I have a Credential Provider which creates an object that inherits ICredentialProvider. ICredentialProvider has a method SetSerialization.
I also have a service, from which I need to call the SetSerialization method of the Credential Provider. The thing is, I'm experienced in C++, but I'm a beginner with COM, so I don't know how. Microsoft's sample 'CSampleProvider's comments say to call the SetSerialization method from a 'remote client', but don't explain how - I assume they assume you know COM.
I've been reading MSDN and various tutorials about COM all day, and I've got to a point where I can create an instance of my Credential Provider in the service, but I need to get a pointer to the Credential Provider object that already exists, not create a new one, and I can't find out how.
How is it done?
Thanks.
The canonical method is via the Running Object Table. That assumes the object has a "moniker", i.e. a COM name, and that this moniker is registered.
Note that the ROT is a form of IPC, specifically a systemwide directory of COM objects.
As Raymond said, in short, you can't - not by any built in COM functionality at least. If you must, it will need to be passed via some form of Inter Process Communication.
I am having a problem with using Boost Logging library, that if I add a formatter or a destination to a logger, using my own Log class, I cannot change that destination or formatter.
Does anybody know how to change the destination or formatter on a boost log object?
The scenario I have is that I want a different destination (file name) for each request my server component handles, so I need to have flexible way to change them. Also the fact that I will be logging from different thread simultanuously, and each Log should really have it's own destination's, easily added - removed.
The fact that with the macro's the logging objects are really app global, does not really aid this.
Can anybody give me some guidance on how I can create a flexible way to add/remove destinations to a Logger from boost::logging?
Ok, here's what I would try. It might work for you. It looks as if the logging library is tailored for global loggers, while you are wanting to use thread-local loggers. I'd look up how to create a logger on demand (i.e. directly), for example by analysing BOOST_DECLARE_LOG. Then you can declare a std::map<int, Logger> that you use to map thread-id to specific logger. Probably you can create your own wrapper class that handles this transparently for client code. Then you just log using your own logging layer and create thread-specific loggers when needed. If you need to remove them after your request is finished you can add a method to do this.
Hope this helps!
I am receiving messages from the network on a non-GUI thread and need to use wxEvtHandler::AddPendingEvent to tell the GUI to update accordingly. I also need to pass data to my GUI code so that it can act apropriately.
I believe I have to create a custom event, but haven't found a straightforward implementation. This closest thing that I've found is The wxWiki on Creating a Custom Event, which is a partial example.
If you are receiving messages from a different thread, then you explicitily can not use AddPendingEvent. You must instead use wxEvtHandler::QueueEvent.
Second, there are a couple of good examples for creating custom event classes: the old way, the new way.
With the old way, you can also use the Connect method and leave off the event table, but it's not illustrated in that example. The new way has the much preferred Bind method... but as you can see in my question, I'm having my own problems with it.