M
Mark
Hi
From what I understand, you can pass arrays from classic ASP to .NET using
interop, but you have to change the type of the.NET parameter to object.
This seems to be because classic ASP passes a variant containing an array,
and interop expects a parameter of type object if you are passing a variant
(you are expected to cast it to the correct type in your code). I'd like to
find a way of passing arrays so that you don't need to change the types of
all arrays to object in method signatures - since this throws away compile
time type checking.
Has anyone got any ideas as to how we could do this? (Unless you use a type
library, ASP queries the CCW for type information - although what is
returned can be changed by overriding the correct method(s) in the object's
IReflect interface).
We have come up with a number of ideas which include writing a wrapper class
which customises IDispatch by overriding IReflect, but does anyone have a
simpler solution? Are there any commercial components which can solve this
problem? We also considering using web services but I don't think that we
would get the same OO semantics using this approach, would we? We could
write a simple .NET wrapper class for each .NET class or we could add extra
methods to the original class in order to solve this problem. Writing a
wrapper object in COM has also been considered, as has passing the data as a
string (which would not be very transparent, it would be inefficient). We
also considered writing our own collection classes which we would us instead
of arrays, but it might be difficult to make this transparent.
Any ideas would be really appreciated..
Thanks
Mark
From what I understand, you can pass arrays from classic ASP to .NET using
interop, but you have to change the type of the.NET parameter to object.
This seems to be because classic ASP passes a variant containing an array,
and interop expects a parameter of type object if you are passing a variant
(you are expected to cast it to the correct type in your code). I'd like to
find a way of passing arrays so that you don't need to change the types of
all arrays to object in method signatures - since this throws away compile
time type checking.
Has anyone got any ideas as to how we could do this? (Unless you use a type
library, ASP queries the CCW for type information - although what is
returned can be changed by overriding the correct method(s) in the object's
IReflect interface).
We have come up with a number of ideas which include writing a wrapper class
which customises IDispatch by overriding IReflect, but does anyone have a
simpler solution? Are there any commercial components which can solve this
problem? We also considering using web services but I don't think that we
would get the same OO semantics using this approach, would we? We could
write a simple .NET wrapper class for each .NET class or we could add extra
methods to the original class in order to solve this problem. Writing a
wrapper object in COM has also been considered, as has passing the data as a
string (which would not be very transparent, it would be inefficient). We
also considered writing our own collection classes which we would us instead
of arrays, but it might be difficult to make this transparent.
Any ideas would be really appreciated..
Thanks
Mark