Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我从 WebService 中提取了几个我转换为 ProductModel 的产品,但是,其中一些产品是“变体”。我需要手动将 ProductModel 转换为 VariantProductModel,有没有 OOTB 方法可以实现这一点?
您不能从类型更改对象。这部分是因为数据类型与PK您的对象相关联。
PK
如果要更改类型,则需要创建 variantProductModel 的新实例,复制所有字段并删除原始产品