| 618 | } |
| 619 | |
| 620 | internal TypeInfo WithRegistrationFrom(TypeInfo source) |
| 621 | { |
| 622 | if (!source.IsRegistered) |
| 623 | { |
| 624 | return this; |
| 625 | } |
| 626 | |
| 627 | if (source.RegisterByName) |
| 628 | { |
| 629 | if (!source.NamespaceName.HasValue || !source.TypeName.HasValue) |
| 630 | { |
| 631 | throw new InvalidDataException("missing type name metadata for name-registered type"); |
| 632 | } |
| 633 | |
| 634 | return WithTypeNameRegistration(source.NamespaceName.Value, source.TypeName.Value); |
| 635 | } |
| 636 | |
| 637 | if (!source.UserTypeId.HasValue) |
| 638 | { |
| 639 | throw new InvalidDataException("missing user type id metadata for id-registered type"); |
| 640 | } |
| 641 | |
| 642 | return WithTypeIdRegistration(source.UserTypeId.Value); |
| 643 | } |
| 644 | |
| 645 | internal TypeInfo WithWireTypeInfo(TypeId wireTypeId, TypeMeta? typeMeta = null) |
| 646 | { |