本文介绍了无法使用OrderClose类时编译代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个插件,做一个salesorder一些操作。我也有一个设置顺序完成。我SDK文档上发现,必须用于履行其在正确的方式

I'm trying to build a plugin that does some operations on a salesorder. I also have to set a order as fulfilled. I found on the SDK documentation an extract that must be used to fulfill the order in the right way

var request = new FulfillSalesOrderRequest
        {
            OrderClose = new OrderClose
            {
                SalesOrderId = new EntityReference
                    { LogicalName = orderEntityName, Id = orderId }

            },
            Status = new OptionSetValue(newStatus)
        };

的问题是,由于MVS说:类型或命名空间名称的代码不能被编译'OrderClose找不到(是否缺少using指令或程序集引用?)。 RightClicking的新OrderClose(OrderClose以红色下划线),我看不出在菜单中解决部分。
我自己也尝试这种方式:

The problem is that the code cannot be compiled because MVS says "The type or namespace name 'OrderClose' could not be found (are you missing a using directive or an assembly reference?)". RightClicking on "new OrderClose" (OrderClose is underlined in red) I cannot see the Resolve section in the menu.I have also tried this way:

        var request = new FulfillSalesOrderRequest();

        request.OrderClose = new OrderClose();

        request.OrderClose.LogicalName = orderEntityName;
        request.OrderClose.Id = orderId;
        request.Status = new OptionSetValue(newStatus);



我怎样才能使代码编译(希望工作)?

How can I make the code compiling (and hopefully working)?

推荐答案

由于 OrderClose 不是一个类,而是一个属性的名称,可以使用不要创建

Since OrderClose is not a class, but the name of a Property, you cannot create it using new.

由于物业类型为实体,您需要创建实体这样的实例:

As the property is of type Entity, you need to create an instance of Entity like this:

request.OrderClose = new Entity();

这篇关于无法使用OrderClose类时编译代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 10:09