Is it possible to implement custom features in .NET?
If so, how?
I suspect the issue is being able to do COM aggregation with .NET, but I can't find anything on that ...
Does anyone know if it is possible to create a (削除) runtime (削除ここまで) COM callable wrapper for a .NET class that supports COM_INTERFACE_ENTRY_AGGREGATE_BLIND ?
-
Wouldn't you be creating a COM-callable wrapper (CCW) rather than a runtime-callable wrapper (RCW), since you're going to publish a managed (.NET) co-class to an unmanaged framework (ArcObjects)?stakx– stakx2010年07月31日 00:46:55 +00:00Commented Jul 31, 2010 at 0:46
-
I updated my answer to reflect new features in .NET 4 where implementing COM aggregation is actually possible.Petr Krebs– Petr Krebs2010年08月03日 07:04:41 +00:00Commented Aug 3, 2010 at 7:04
-
Also, while I don't have any proof for this, it seems that Managed C++ grants you some more freedom when dealing with COM. In case that you don't find a good way to do this with C#, you could have a look at Managed C++ for the critical pieces of code.stakx– stakx2010年08月22日 19:07:25 +00:00Commented Aug 22, 2010 at 19:07
1 Answer 1
You will be unable to implement pure COM aggregation in .NET 3.5 or lower, but you may be lucky in .NET 4, which adds the new ICustomQueryInterface interface, allowing you to redirect the interface queries properly. More information with a sample included can be found on codeplex.
I also recommend to proceed along the C++ ESRI docs sample. The link is for 9.0, but I suspect this particular sample has not changed one bit.
-
Since this problem interests me a lot, I'll try to port the ESRI's sample to .NET 4 C#.Petr Krebs– Petr Krebs2010年08月03日 09:36:48 +00:00Commented Aug 3, 2010 at 9:36
-
Hey Petr, that would be great to have a C# version of the sample! Even though the ArcGIS 10.0 PIA's are for 3.5, I guess custom features can still be 4.0(?) I'll add a bounty to this question in a couple of days.Kirk Kuykendall– Kirk Kuykendall2010年08月03日 17:59:28 +00:00Commented Aug 3, 2010 at 17:59
-
@Petr how's that sample coming ;)blah238– blah2382011年07月27日 07:44:43 +00:00Commented Jul 27, 2011 at 7:44
-
@blah238: turned out it's not that easy as it looked like.. ;) There is not much documentation or samples as to .NET COM aggregation out there. I'll try to come back to it.Petr Krebs– Petr Krebs2011年07月27日 08:03:44 +00:00Commented Jul 27, 2011 at 8:03
-
@Kirk: BTW - We ran into some really strange issues when trying to do extensions using .NET 4 - so I wouldn't recommend it. I ended up having to backport a ton of our code to 3.5sp1 to get things to work properly, at least with 10sp1. (One example - subscribing to certain document events, and doing nothing else, will disable right click menus in ArcMap - even though it's totally unrelated functionality...)Reed Copsey– Reed Copsey2011年07月27日 16:21:11 +00:00Commented Jul 27, 2011 at 16:21