ediFabric 6.7.7 - 通用 EDI 消息的验证

ediFabric 6.7.7 - validation of generic EDI message

我正在使用新更新的 ediFabric 6.7.7,我正在尝试验证通用消息 - 所以我无法将其转换为特定 class 的特定版本。

我对 xml 序列化有疑问。

此代码有效(它与 ediFabric 单元测试中的代码非常相似)

var invoice = (M_810) msg.Value;
var validation  = new List<string>(invoice.ValidateX12(xsdStream));

但这会引发异常

var validation  = new List<string>(msg.Value.ValidateX12(xsdStream));

System.InvalidOperationException: The type EdiFabric.Rules.X12004010810.M_810 was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically

所以我的问题是 - 是否有可能以某种方式验证通用消息,w\o 明确地将其转换为特定的 class。

我在这里获得正确模式的方式是通过 GS Header 和 ST01 通过反射。

当然我可以编写自己的 Xml 序列化程序并使用 XsdSchemaCollection 针对 Xsd 模式进行验证,但是 EdiMessage<S_ISA, S_GS> 包含 ValidateX12() 方法,我想要尽可能使用它。

现在版本 6.8.2 中可用。你可以这样称呼它: var validation = new List(msg.Value.Validate());

它现在在内部解析 xsd 和格式。