From 6a02b707e11c6f651ec69f67e5e4a46211442721 Mon Sep 17 00:00:00 2001 From: Iain Ballard Date: Wed, 18 Jul 2012 15:39:50 +0100 Subject: [PATCH] Adding auto conversion for extended simple objects --- src/AutoGenerated/releaseNotification.cs | 324 ++++++++++++++++++ src/AutoGenerated/vehicles.cs | 3 + .../AutoGeneratedClassesTest.cs | 5 +- ...enDigital.Parsing.XsdToObject.Tests.csproj | 1 + .../ClassWriter.cs | 12 +- 5 files changed, 341 insertions(+), 4 deletions(-) diff --git a/src/AutoGenerated/releaseNotification.cs b/src/AutoGenerated/releaseNotification.cs index 3090b60..d6b636d 100644 --- a/src/AutoGenerated/releaseNotification.cs +++ b/src/AutoGenerated/releaseNotification.cs @@ -1940,6 +1940,9 @@ public WebPolicy() public class AdditionalInformation { + public override string ToString(){return Value;} + public static implicit operator string(AdditionalInformation obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2012,6 +2015,9 @@ public AmountPerCollection() public class Annotation { + public override string ToString(){return Value;} + public static implicit operator string(Annotation obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2027,6 +2033,9 @@ public Annotation() public class AppliedRoyaltyRate { + public override string ToString(){return Value;} + public static implicit operator string(AppliedRoyaltyRate obj){return obj.Value;} + public string Value { get; set; } public string ValueType { get; set; } public string RoyaltyRateType { get; set; } @@ -2067,6 +2076,9 @@ public Artist() public class ArtistRole { + public override string ToString(){return Value;} + public static implicit operator string(ArtistRole obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2084,6 +2096,9 @@ public ArtistRole() public class AudioCodecType { + public override string ToString(){return Value;} + public static implicit operator string(AudioCodecType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -2118,6 +2133,9 @@ public AvRating() public class BitRate { + public override string ToString(){return Value;} + public static implicit operator string(BitRate obj){return obj.Value;} + public string Value { get; set; } public string UnitOfMeasure { get; set; } @@ -2152,6 +2170,9 @@ public CLine() public class CalculationType { + public override string ToString(){return Value;} + public static implicit operator string(CalculationType obj){return obj.Value;} + public string Value { get; set; } public string SequenceNumber { get; set; } @@ -2167,6 +2188,9 @@ public CalculationType() public class CarrierType { + public override string ToString(){return Value;} + public static implicit operator string(CarrierType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2184,6 +2208,9 @@ public CarrierType() public class CatalogNumber { + public override string ToString(){return Value;} + public static implicit operator string(CatalogNumber obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -2199,6 +2226,9 @@ public CatalogNumber() public class CdProtectionType { + public override string ToString(){return Value;} + public static implicit operator string(CdProtectionType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2388,6 +2418,9 @@ public CollectionResourceReferenceList1() public class CollectionType { + public override string ToString(){return Value;} + public static implicit operator string(CollectionType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2405,6 +2438,9 @@ public CollectionType() public class Comment { + public override string ToString(){return Value;} + public static implicit operator string(Comment obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2420,6 +2456,9 @@ public Comment() public class CommercialModelType { + public override string ToString(){return Value;} + public static implicit operator string(CommercialModelType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2437,6 +2476,9 @@ public CommercialModelType() public class ConsumerRentalPeriod { + public override string ToString(){return Value;} + public static implicit operator string(ConsumerRentalPeriod obj){return obj.Value;} + public string Value { get; set; } public string IsExtensible { get; set; } @@ -2452,6 +2494,9 @@ public ConsumerRentalPeriod() public class ContainerFormat { + public override string ToString(){return Value;} + public static implicit operator string(ContainerFormat obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2469,6 +2514,9 @@ public ContainerFormat() public class CourtesyLine { + public override string ToString(){return Value;} + public static implicit operator string(CourtesyLine obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2575,6 +2623,9 @@ public CueCreationReference() public class CueOrigin { + public override string ToString(){return Value;} + public static implicit operator string(CueOrigin obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2624,6 +2675,9 @@ public CueSheetList1() public class CueSheetType { + public override string ToString(){return Value;} + public static implicit operator string(CueSheetType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2641,6 +2695,9 @@ public CueSheetType() public class CueThemeType { + public override string ToString(){return Value;} + public static implicit operator string(CueThemeType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2658,6 +2715,9 @@ public CueThemeType() public class CueUseType { + public override string ToString(){return Value;} + public static implicit operator string(CueUseType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2675,6 +2735,9 @@ public CueUseType() public class CueVisualPerceptionType { + public override string ToString(){return Value;} + public static implicit operator string(CueVisualPerceptionType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2692,6 +2755,9 @@ public CueVisualPerceptionType() public class CueVocalType { + public override string ToString(){return Value;} + public static implicit operator string(CueVocalType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2732,6 +2798,9 @@ public DSP() public class DealReference { + public override string ToString(){return Value;} + public static implicit operator string(DealReference obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2747,6 +2816,9 @@ public DealReference() public class DeductionRate { + public override string ToString(){return Value;} + public static implicit operator string(DeductionRate obj){return obj.Value;} + public string Value { get; set; } public string DeductionRateType { get; set; } public string DeductionDescription { get; set; } @@ -2766,6 +2838,9 @@ public DeductionRate() public class Description { + public override string ToString(){return Value;} + public static implicit operator string(Description obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2781,6 +2856,9 @@ public Description() public class DistributionChannelDescriptor { + public override string ToString(){return Value;} + public static implicit operator string(DistributionChannelDescriptor obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -2796,6 +2874,9 @@ public DistributionChannelDescriptor() public class DistributionChannelType { + public override string ToString(){return Value;} + public static implicit operator string(DistributionChannelType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -2813,6 +2894,9 @@ public DistributionChannelType() public class DrmPlatformType { + public override string ToString(){return Value;} + public static implicit operator string(DrmPlatformType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -2880,6 +2964,9 @@ public ErnMessageInBatch() public class EventDate { + public override string ToString(){return Value;} + public static implicit operator string(EventDate obj){return obj.Value;} + public string Value { get; set; } public string IsApproximate { get; set; } public string IsBefore { get; set; } @@ -2905,6 +2992,9 @@ public EventDate() public class EventDateTime { + public override string ToString(){return Value;} + public static implicit operator string(EventDateTime obj){return obj.Value;} + public string Value { get; set; } public string IsApproximate { get; set; } public string IsBefore { get; set; } @@ -2930,6 +3020,9 @@ public EventDateTime() public class Extent { + public override string ToString(){return Value;} + public static implicit operator string(Extent obj){return obj.Value;} + public string Value { get; set; } public string UnitOfMeasure { get; set; } @@ -2945,6 +3038,9 @@ public Extent() public class ExternalLocationDescriptor { + public override string ToString(){return Value;} + public static implicit operator string(ExternalLocationDescriptor obj){return obj.Value;} + public string Value { get; set; } public string DescriptorSyntax { get; set; } @@ -2981,6 +3077,9 @@ public ExternalResourceLink() public class ExternallyLinkedResourceType { + public override string ToString(){return Value;} + public static implicit operator string(ExternallyLinkedResourceType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3036,6 +3135,9 @@ public Fingerprint() public class FingerprintAlgorithmType { + public override string ToString(){return Value;} + public static implicit operator string(FingerprintAlgorithmType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3053,6 +3155,9 @@ public FingerprintAlgorithmType() public class FrameRate { + public override string ToString(){return Value;} + public static implicit operator string(FrameRate obj){return obj.Value;} + public string Value { get; set; } public string UnitOfMeasure { get; set; } @@ -3100,6 +3205,9 @@ public Genre() public class GoverningAgreementType { + public override string ToString(){return Value;} + public static implicit operator string(GoverningAgreementType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3117,6 +3225,9 @@ public GoverningAgreementType() public class GuaranteedAmount { + public override string ToString(){return Value;} + public static implicit operator string(GuaranteedAmount obj){return obj.Value;} + public string Value { get; set; } public string CurrencyCode { get; set; } public string ReferenceUnit { get; set; } @@ -3149,6 +3260,9 @@ public HashSum() public class HashSumAlgorithmType { + public override string ToString(){return Value;} + public static implicit operator string(HashSumAlgorithmType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3191,6 +3305,9 @@ public HostSoundCarrier() public class ICPN { + public override string ToString(){return Value;} + public static implicit operator string(ICPN obj){return obj.Value;} + public string Value { get; set; } public string IsEan { get; set; } @@ -3206,6 +3323,9 @@ public ICPN() public class ImageCodecType { + public override string ToString(){return Value;} + public static implicit operator string(ImageCodecType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -3269,6 +3389,9 @@ public ImageId() public class ImageType { + public override string ToString(){return Value;} + public static implicit operator string(ImageType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3305,6 +3428,9 @@ public IndirectResourceContributor() public class Keywords { + public override string ToString(){return Value;} + public static implicit operator string(Keywords obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -3320,6 +3446,9 @@ public Keywords() public class LabelName { + public override string ToString(){return Value;} + public static implicit operator string(LabelName obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } public string LabelNameType { get; set; } @@ -3337,6 +3466,9 @@ public LabelName() public class LicenseOrClaimRefusalReason { + public override string ToString(){return Value;} + public static implicit operator string(LicenseOrClaimRefusalReason obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3354,6 +3486,9 @@ public LicenseOrClaimRefusalReason() public class LicenseOrClaimRequestUpdateReason { + public override string ToString(){return Value;} + public static implicit operator string(LicenseOrClaimRequestUpdateReason obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3371,6 +3506,9 @@ public LicenseOrClaimRequestUpdateReason() public class LicenseOrClaimUpdateReason { + public override string ToString(){return Value;} + public static implicit operator string(LicenseOrClaimUpdateReason obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3388,6 +3526,9 @@ public LicenseOrClaimUpdateReason() public class LinkedReleaseResourceReference { + public override string ToString(){return Value;} + public static implicit operator string(LinkedReleaseResourceReference obj){return obj.Value;} + public string Value { get; set; } public string LinkDescription { get; set; } public string LanguageAndScriptCode { get; set; } @@ -3405,6 +3546,9 @@ public LinkedReleaseResourceReference() public class MessageActionType { + public override string ToString(){return Value;} + public static implicit operator string(MessageActionType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3571,6 +3715,9 @@ public MidiId() public class MidiType { + public override string ToString(){return Value;} + public static implicit operator string(MidiType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3640,6 +3787,9 @@ public MusicalWorkContributor() public class MusicalWorkContributorRole { + public override string ToString(){return Value;} + public static implicit operator string(MusicalWorkContributorRole obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3697,6 +3847,9 @@ public MusicalWorkId() public class MusicalWorkType { + public override string ToString(){return Value;} + public static implicit operator string(MusicalWorkType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3714,6 +3867,9 @@ public MusicalWorkType() public class Name { + public override string ToString(){return Value;} + public static implicit operator string(Name obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -3729,6 +3885,9 @@ public Name() public class NumberOfDataMismatchItems { + public override string ToString(){return Value;} + public static implicit operator string(NumberOfDataMismatchItems obj){return obj.Value;} + public string Value { get; set; } public string DataMismatchStatus { get; set; } @@ -3765,6 +3924,9 @@ public NumberOfSubscribers() public class OperatingSystemType { + public override string ToString(){return Value;} + public static implicit operator string(OperatingSystemType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -3784,6 +3946,9 @@ public OperatingSystemType() public class OrderType { + public override string ToString(){return Value;} + public static implicit operator string(OrderType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3822,6 +3987,9 @@ public PLine() public class ParentalWarningType { + public override string ToString(){return Value;} + public static implicit operator string(ParentalWarningType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -3854,6 +4022,9 @@ public PartyDescriptor() public class PartyId { + public override string ToString(){return Value;} + public static implicit operator string(PartyId obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string IsDPID { get; set; } @@ -3919,6 +4090,9 @@ public Period() public class Price { + public override string ToString(){return Value;} + public static implicit operator string(Price obj){return obj.Value;} + public string Value { get; set; } public string CurrencyCode { get; set; } @@ -3934,6 +4108,9 @@ public Price() public class PriceConsumerPaidExcSalesTax { + public override string ToString(){return Value;} + public static implicit operator string(PriceConsumerPaidExcSalesTax obj){return obj.Value;} + public string Value { get; set; } public string CurrencyCode { get; set; } @@ -3972,6 +4149,9 @@ public PriceInformation() public class PriceRangeType { + public override string ToString(){return Value;} + public static implicit operator string(PriceRangeType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -3987,6 +4167,9 @@ public PriceRangeType() public class PriceType { + public override string ToString(){return Value;} + public static implicit operator string(PriceType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -4002,6 +4185,9 @@ public PriceType() public class ProductType { + public override string ToString(){return Value;} + public static implicit operator string(ProductType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4019,6 +4205,9 @@ public ProductType() public class PromotionalCode { + public override string ToString(){return Value;} + public static implicit operator string(PromotionalCode obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -4034,6 +4223,9 @@ public PromotionalCode() public class ProprietaryId { + public override string ToString(){return Value;} + public static implicit operator string(ProprietaryId obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -4049,6 +4241,9 @@ public ProprietaryId() public class Purpose { + public override string ToString(){return Value;} + public static implicit operator string(Purpose obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4066,6 +4261,9 @@ public Purpose() public class RatingAgency { + public override string ToString(){return Value;} + public static implicit operator string(RatingAgency obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4083,6 +4281,9 @@ public RatingAgency() public class Reason { + public override string ToString(){return Value;} + public static implicit operator string(Reason obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -4098,6 +4299,9 @@ public Reason() public class ReasonType { + public override string ToString(){return Value;} + public static implicit operator string(ReasonType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4138,6 +4342,9 @@ public RecordCompanyMarketShareData() public class RedeliveryReasonType { + public override string ToString(){return Value;} + public static implicit operator string(RedeliveryReasonType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4229,6 +4436,9 @@ public RelatedRelease() public class ReleaseAvailabilityStatus { + public override string ToString(){return Value;} + public static implicit operator string(ReleaseAvailabilityStatus obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4246,6 +4456,9 @@ public ReleaseAvailabilityStatus() public class ReleaseCollectionReference { + public override string ToString(){return Value;} + public static implicit operator string(ReleaseCollectionReference obj){return obj.Value;} + public string Value { get; set; } public string ReleaseResourceType { get; set; } @@ -4334,6 +4547,9 @@ public ReleaseId() public class ReleaseRelationshipType { + public override string ToString(){return Value;} + public static implicit operator string(ReleaseRelationshipType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4351,6 +4567,9 @@ public ReleaseRelationshipType() public class ReleaseResourceReference { + public override string ToString(){return Value;} + public static implicit operator string(ReleaseResourceReference obj){return obj.Value;} + public string Value { get; set; } public string ReleaseResourceType { get; set; } @@ -4423,6 +4642,9 @@ public ReleaseSummaryDetailsByTerritory() public class ReleaseType { + public override string ToString(){return Value;} + public static implicit operator string(ReleaseType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4440,6 +4662,9 @@ public ReleaseType() public class RemittanceAdvice { + public override string ToString(){return Value;} + public static implicit operator string(RemittanceAdvice obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -4455,6 +4680,9 @@ public RemittanceAdvice() public class ReportFormat { + public override string ToString(){return Value;} + public static implicit operator string(ReportFormat obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4472,6 +4700,9 @@ public ReportFormat() public class ReportType { + public override string ToString(){return Value;} + public static implicit operator string(ReportType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4540,6 +4771,9 @@ public ResourceContributor() public class ResourceContributorRole { + public override string ToString(){return Value;} + public static implicit operator string(ResourceContributorRole obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4633,6 +4867,9 @@ public ResourceMusicalWorkReferenceList() public class ResourceOmissionReason { + public override string ToString(){return Value;} + public static implicit operator string(ResourceOmissionReason obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4650,6 +4887,9 @@ public ResourceOmissionReason() public class ResourceType { + public override string ToString(){return Value;} + public static implicit operator string(ResourceType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4773,6 +5013,9 @@ public RightsController() public class RightsType { + public override string ToString(){return Value;} + public static implicit operator string(RightsType obj){return obj.Value;} + public string Value { get; set; } public string TerritoryCode { get; set; } public string Namespace { get; set; } @@ -4792,6 +5035,9 @@ public RightsType() public class RoyaltyAmount { + public override string ToString(){return Value;} + public static implicit operator string(RoyaltyAmount obj){return obj.Value;} + public string Value { get; set; } public string CurrencyCode { get; set; } @@ -4807,6 +5053,9 @@ public RoyaltyAmount() public class RoyaltyCode { + public override string ToString(){return Value;} + public static implicit operator string(RoyaltyCode obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -4839,6 +5088,9 @@ public SalesReportingProxyReleaseId() public class SamplingRate { + public override string ToString(){return Value;} + public static implicit operator string(SamplingRate obj){return obj.Value;} + public string Value { get; set; } public string UnitOfMeasure { get; set; } @@ -4854,6 +5106,9 @@ public SamplingRate() public class SheetMusicCodecType { + public override string ToString(){return Value;} + public static implicit operator string(SheetMusicCodecType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -4919,6 +5174,9 @@ public SheetMusicId() public class SheetMusicType { + public override string ToString(){return Value;} + public static implicit operator string(SheetMusicType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -4997,6 +5255,9 @@ public SoftwareId() public class SoftwareType { + public override string ToString(){return Value;} + public static implicit operator string(SoftwareType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5014,6 +5275,9 @@ public SoftwareType() public class SoundProcessorType { + public override string ToString(){return Value;} + public static implicit operator string(SoundProcessorType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -5127,6 +5391,9 @@ public SoundRecordingId() public class SoundRecordingType { + public override string ToString(){return Value;} + public static implicit operator string(SoundRecordingType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5144,6 +5411,9 @@ public SoundRecordingType() public class StoreLocationDescriptor { + public override string ToString(){return Value;} + public static implicit operator string(StoreLocationDescriptor obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -5159,6 +5429,9 @@ public StoreLocationDescriptor() public class SubTitle { + public override string ToString(){return Value;} + public static implicit operator string(SubTitle obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -5174,6 +5447,9 @@ public SubTitle() public class SupplyChainStatus { + public override string ToString(){return Value;} + public static implicit operator string(SupplyChainStatus obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5191,6 +5467,9 @@ public SupplyChainStatus() public class Synopsis { + public override string ToString(){return Value;} + public static implicit operator string(Synopsis obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -5206,6 +5485,9 @@ public Synopsis() public class TariffReference { + public override string ToString(){return Value;} + public static implicit operator string(TariffReference obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } public string TariffSubReference { get; set; } @@ -5223,6 +5505,9 @@ public TariffReference() public class Tax { + public override string ToString(){return Value;} + public static implicit operator string(Tax obj){return obj.Value;} + public string Value { get; set; } public string CurrencyCode { get; set; } @@ -5255,6 +5540,9 @@ public TaxRate() public class TaxScope { + public override string ToString(){return Value;} + public static implicit operator string(TaxScope obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5272,6 +5560,9 @@ public TaxScope() public class TaxType { + public override string ToString(){return Value;} + public static implicit operator string(TaxType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5308,6 +5599,9 @@ public TechnicalInstantiation() public class TextCodecType { + public override string ToString(){return Value;} + public static implicit operator string(TextCodecType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -5375,6 +5669,9 @@ public TextId() public class TextType { + public override string ToString(){return Value;} + public static implicit operator string(TextType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5411,6 +5708,9 @@ public Title() public class TitleText { + public override string ToString(){return Value;} + public static implicit operator string(TitleText obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } @@ -5443,6 +5743,9 @@ public TotalRoyaltyAmount() public class TypedSubTitle { + public override string ToString(){return Value;} + public static implicit operator string(TypedSubTitle obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } public string SubTitleType { get; set; } @@ -5483,6 +5786,9 @@ public Usage() public class UseType { + public override string ToString(){return Value;} + public static implicit operator string(UseType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5544,6 +5850,9 @@ public UserDefinedResourceId() public class UserDefinedResourceType { + public override string ToString(){return Value;} + public static implicit operator string(UserDefinedResourceType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } @@ -5559,6 +5868,9 @@ public UserDefinedResourceType() public class UserDefinedValue { + public override string ToString(){return Value;} + public static implicit operator string(UserDefinedValue obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string Description { get; set; } @@ -5578,6 +5890,9 @@ public UserDefinedValue() public class UserInterfaceType { + public override string ToString(){return Value;} + public static implicit operator string(UserInterfaceType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5595,6 +5910,9 @@ public UserInterfaceType() public class VideoCodecType { + public override string ToString(){return Value;} + public static implicit operator string(VideoCodecType obj){return obj.Value;} + public string Value { get; set; } public string Version { get; set; } public string Namespace { get; set; } @@ -5702,6 +6020,9 @@ public VideoId() public class VideoType { + public override string ToString(){return Value;} + public static implicit operator string(VideoType obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } @@ -5757,6 +6078,9 @@ public WorkList() public class WsMessageStatus { + public override string ToString(){return Value;} + public static implicit operator string(WsMessageStatus obj){return obj.Value;} + public string Value { get; set; } public string Namespace { get; set; } public string UserDefinedValue { get; set; } diff --git a/src/AutoGenerated/vehicles.cs b/src/AutoGenerated/vehicles.cs index 4dac79a..5fde785 100644 --- a/src/AutoGenerated/vehicles.cs +++ b/src/AutoGenerated/vehicles.cs @@ -72,6 +72,9 @@ public Title_x() public class LabelName_x { + public override string ToString(){return Value;} + public static implicit operator string(LabelName_x obj){return obj.Value;} + public string Value { get; set; } public string LanguageAndScriptCode { get; set; } public string LabelNameType { get; set; } diff --git a/src/SevenDigital.Parsing.XsdToObject.Tests/AutoGeneratedClassesTest.cs b/src/SevenDigital.Parsing.XsdToObject.Tests/AutoGeneratedClassesTest.cs index 9a4b889..295e196 100644 --- a/src/SevenDigital.Parsing.XsdToObject.Tests/AutoGeneratedClassesTest.cs +++ b/src/SevenDigital.Parsing.XsdToObject.Tests/AutoGeneratedClassesTest.cs @@ -34,7 +34,8 @@ public void ShouldHaveBMW() Assert.That(car.Color.Title.TitleText, Is.EqualTo("This is the text")); Assert.That(car.Color.Title.TitleType, Is.EqualTo("thisIsTheType")); Assert.That(car.Color.LabelName.LabelNameType, Is.EqualTo("MajorLabel")); - Assert.That(car.Color.LabelName.Value, Is.EqualTo("WM International - Phil Collins")); + + Assert.That((string)car.Color.LabelName, Is.EqualTo("WM International - Phil Collins")); } [Test] @@ -44,7 +45,7 @@ public void ShouldHaveHonda() Assert.That(car.Color.Hue, Is.EqualTo("red")); Assert.That(car.Color.Rgb, Is.EqualTo("0xff0000")); Assert.That(car.Color.LabelName.LabelNameType, Is.Null); - Assert.That(car.Color.LabelName.Value, Is.EqualTo("WM UK")); + Assert.That((string)car.Color.LabelName, Is.EqualTo("WM UK")); } } } diff --git a/src/SevenDigital.Parsing.XsdToObject.Tests/SevenDigital.Parsing.XsdToObject.Tests.csproj b/src/SevenDigital.Parsing.XsdToObject.Tests/SevenDigital.Parsing.XsdToObject.Tests.csproj index 6b65526..740986d 100644 --- a/src/SevenDigital.Parsing.XsdToObject.Tests/SevenDigital.Parsing.XsdToObject.Tests.csproj +++ b/src/SevenDigital.Parsing.XsdToObject.Tests/SevenDigital.Parsing.XsdToObject.Tests.csproj @@ -50,6 +50,7 @@ PreserveNewest + Designer diff --git a/src/SevenDigital.Parsing.XsdToObject/ClassWriter.cs b/src/SevenDigital.Parsing.XsdToObject/ClassWriter.cs index 7363ca4..70c4c49 100644 --- a/src/SevenDigital.Parsing.XsdToObject/ClassWriter.cs +++ b/src/SevenDigital.Parsing.XsdToObject/ClassWriter.cs @@ -114,8 +114,10 @@ private void GenerateProperties(ClassInfo classInfo) { foreach (PropertyInfo property in classInfo.Properties) { - _writer.WriteLine("\t\tpublic {0} {1} {{ get; set; }}", property.GetCodeType(), property.GetCodeName()); - } + if (property.IsElementValue) WriteImplicitStringCast(classInfo); + + _writer.WriteLine("\t\tpublic {0} {1} {{ get; set; }}", property.GetCodeType(), property.GetCodeName()); + } foreach (string property in classInfo.Attributes) { @@ -123,5 +125,11 @@ private void GenerateProperties(ClassInfo classInfo) } } + void WriteImplicitStringCast(ClassInfo classInfo) + { + _writer.WriteLine("\t\tpublic override string ToString(){return Value;}"); + _writer.WriteLine("\t\tpublic static implicit operator string("+classInfo.GetCodeName()+" obj){return obj.Value;}"); + _writer.WriteLine(); + } } } \ No newline at end of file