小编JoR*_*JoR的帖子

使用VB.net中的linq搜索对象列表中的对象列表

我有2节课

Public Class Shipper

    Public Property ShipperID As Long
    Public Property CreateDate As DateTime
    Public Property ShipperCode As String
    Public Property ShipperName As String
    Public Property ShippingMethods As List(Of ShippingMethod)

Public Class ShippingMethod

    Public Property ShippingMethodID As Long
    Public Property ShipperID As Long
    Public Property CreateDate As DateTime
    Public Property ShipppingMethod As String
    Public Property ShipppingMethodCode As String
Run Code Online (Sandbox Code Playgroud)

我正在尝试搜索托运人名单为空白且托运人姓名不为空白的托运人名单 - 我得到了

Dim oListShipper As List(Of Shipper) = GetAllShippers()
Dim oListShipperRet As List(Of Shipper) = _
        oListShipper.FindAll(Function(c) (c.ShipperCode = "" And …
Run Code Online (Sandbox Code Playgroud)

.net linq vb.net lambda

4
推荐指数
1
解决办法
2万
查看次数

Unity InjectionConstructor传递对象数组

我正在尝试使用unity注册依赖项并将值传递给构造函数,使用下面的代码

container.RegisterType<IProviderContext, MockOrderServiceProviderContext>(new InjectionConstructor(new Pharmacy {SiteId = 2,DistrictCode = "2"}));
Run Code Online (Sandbox Code Playgroud)

但我越来越

“类型OrderService.Business.MockOrderServiceProviderContext没有采用参数(Pharmacy)的构造函数。”

构造函数。

public MockOrderServiceProviderContext(params object[] objects)
     {
         _object = objects;
     }
Run Code Online (Sandbox Code Playgroud)

如何传递对象数组的构造函数值?

谢谢

dependency-injection unity-container

2
推荐指数
1
解决办法
1532
查看次数