我在 Asp.Net Mvc 中有这样的模型:
 public class CustomerModel : BaseModel
    {
        public CustomerModel()
        {
            Vats = new List<Vat>();
            SelectedVat = new List<long>();
            AdressItems = new List<AddressModel>();
            CustomerTypes = new List<CustomerType>();
            CustomerType = new List<long>();
            Factory = new Factory();
            Company = new Company();
            Branch = new BranchModel();
            Transporter = new TransporterModel();
            Cities = new List<City>();
            SelectedCity = new List<long>();
            SelectedWareHouse = new WareHouseModel();
            WareHouses = new List<WareHouseModel>();
            SelectedAddress = new AddressModel();
            Addresses = new List<AddressModel>();
        }
        public long Id { get; set; }
        public string Title { get; set; }
        public string SignBoard { get; set; }
        public long? VatId { get; set; }
        public bool IsHasWarehouse { get; set; }
        public bool IsManifacturer { get; set; }
        public bool Valid { get; set; }
        public List<AddressModel> AdressItems { get; set; }
        public List<CustomerType> CustomerTypes { get; set; }
        public List<long> CustomerType { get; set; }
        public Factory Factory { get; set; }
        public Company Company { get; set; }
        public BranchModel Branch{ get; set; }
        public TransporterModel Transporter { get; set; }
        public List<Vat> Vats { get; set; }
        public List<long> SelectedVat { get; set; }
        public List<City> Cities { get; set; }
        public List<long> SelectedCity { get; set; }
        public List<WareHouseModel> WareHouses { get; set; }
        public WareHouseModel SelectedWareHouse { get; set; }
        public List<AddressModel> Addresses { get; set; }
        public AddressModel SelectedAddress { get; set; }
    }
我将它发送到我的视图并将其映射到淘汰赛 js 模型。然后当我查看模型时,我看到 Id、Title、Vats 和 SelectedCity 是可观察的,除了 Factory 和其他类似定义的对象。
我搜索了很长时间才找到原因,但我找不到。
有人对此有想法吗?
编辑:推送到映射之前的 viewModel 是这样的:
