从ColdFusion调用具有列表的.NET方法时未找到方法
在某些背景下,这与。我已将代码改为使用列表,并取得了进展,但在使用.NET和ColdFusion中的简单数据类型以外的任何其他类型时,仍然会遇到障碍。这就是当前的问题 首先,我有一个.dll,其中包含以下VideoWallEvent.cs文件:从ColdFusion调用具有列表的.NET方法时未找到方法,.net,coldfusion,coldfusion-10,.net,Coldfusion,Coldfusion 10,在某些背景下,这与。我已将代码改为使用列表,并取得了进展,但在使用.NET和ColdFusion中的简单数据类型以外的任何其他类型时,仍然会遇到障碍。这就是当前的问题 首先,我有一个.dll,其中包含以下VideoWallEvent.cs文件: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CoStar.Utilities.VideoWall {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CoStar.Utilities.VideoWall
{
public class VideoWallEventActivityCollection
{
public string CountryCode { get; set; }
public DateTime ActivityDate { get; set; }
public List<VideoWallEvent> Events { get; set; }
}
public class VideoWallEvent
{
public string ID { get; set; }
public decimal Latitude { get; set; }
public decimal Longitude { get; set; }
public VideoWallEvent(string EventID, decimal EventLatitude, decimal EventLongitude)
{
ID = EventID;
Latitude = EventLatitude;
Longitude = EventLongitude;
}
}
}
这为我提供了以下输出:
正如您从屏幕截图中看到的,我可以成功地将项目添加到列表中,我可以获得需要列表对象的ActivityCollection对象,但是调用Set\u Events
方法并传递列表会引发以下错误:
The Set_Events method was not found.
Either there are no methods with the specified method name and argument types
or the Set_Events method is overloaded with argument types that ColdFusion cannot
decipher reliably. ColdFusion found 0 methods that match the provided arguments.
If this is a Java object and you verified that the method exists, use the javacast
function to reduce ambiguity.
The error occurred in C:/inetpub/scribble/VideoWall/index.cfm: line 17
15 : <cfdump var="#eventList#" label="eventList" />
16 :
17 : <cfset eventCollection.Set_Events(eventList) />
找不到Set_Events方法。
没有具有指定方法名称和参数类型的方法
或者Set_Events方法被ColdFusion无法重载的参数类型重载
可靠地破译。ColdFusion找到0个与提供的参数匹配的方法。
如果这是一个Java对象,并且您验证了该方法存在,请使用javacast
减少歧义的功能。
错误出现在C:/inetpub/scribble/VideoWall/index.cfm:第17行
15 :
16 :
17 :
因此,我现在需要帮助了解如何正确地将此列表推送到Set_Events()方法中。(来自注释)
信不信由你,这只是一个组装路径问题。您必须使用程序集列表中的两个文件,而不仅仅是成本实用性,即:
<cfset eventCollection = CreateObject(".net"
, "CoStar.Utilities.VideoWall.VideoWallEventActivityCollection"
, Paths ) />
我很想知道如果你打电话会得到什么,我想知道DotNetProxy是否错误地设置了Set_Events()mutator。我想知道,如果在构造过程中使用空列表初始化Events属性,会不会有什么不同。。。法律。我在path参数中只使用了Utilities.dll。一旦我包含了Utilities.dll和我从JNBProxyGUI.exe创建的代理,所有内容似乎都已正确填充。信不信由你,这只是一个程序集路径问题。您必须在程序集列表中同时使用两个JAR,而不仅仅是costaruutilities
。(编辑:-别担心,我看到你发现了)。Leigh,请将你的评论作为答案发布,我会将其标记为接受,因为你发现了这个问题,而我只是碰巧在清理变量引用时得到了正确的答案。
<cfset eventCollection = CreateObject(".net"
, "CoStar.Utilities.VideoWall.VideoWallEventActivityCollection"
, Paths ) />