Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826

    wcf e deserializzazione preserveObjectReferences

    ciao.
    sono passato a wcf per riuscire a deserializzare correttamente il mio xml e ho usato la proprietareserveobjectreference = true.
    tutto bene finalmente per gli elementi ma sostituire il riferimento a un oggetto non ci riesco
    questo è l'xml
    questo i l deserializzatore
    ho creato le classi con serviceutil
    codice:
     DataContractSerializer dcs = new DataContractSerializer(typeof(iso.org.standard._10303.part28.version2.xmlschema.common.iso_10303_28), null,
                    int.MaxValue /*maxItemsInObjectGraph*/,
                    false /*ignoreExtensionDataObject*/,
                    true /*preserveObjectReferences : this is where the magic happens */,
                    null /*dataContractSurrogate*/);


    codice:
    <?xml version="1.0" encoding="UTF-8"?>
    <iso_10303_28 version="2.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xlink="http://www.w3.org/1999/xlink" 
        xmlns="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" 
        >
    
        <iso_10303_28_header>
            <name>Spaces.ifc</name>
            <time_stamp>2007-06-08T19:41:10</time_stamp>
            <author>Architect</author>
            <organization>Building Designer Office</organization>
            <preprocessor_version>Express Data Manager Version 4.7.065 Oct 30 2006</preprocessor_version>
            <originating_system>Windows System</originating_system>
            <authorization>The authorising person</authorization>
            <documentation>ArchiCAD 10.00 Release 1.Build Number of the Ifc 2x3 interface: 63044 (18-04-2007)</documentation>
        </iso_10303_28_header>
        <uos id="uos_1" description="" edo="" configuration="default" xmlns="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" xsi:schemaLocation="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL IFC2X3.xsd"
        xmlns:ex="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" >
            <IfcAxis2Placement3D id="i1637">
                <Location>
                    <IfcCartesianPoint id="i1668">
                        <Coordinates cType="list">
                            <IfcLengthMeasure pos="0">0.</IfcLengthMeasure>
                            <IfcLengthMeasure pos="1">0.</IfcLengthMeasure>
                            <IfcLengthMeasure pos="2">0.</IfcLengthMeasure>
                        </Coordinates>
                    </IfcCartesianPoint>
                </Location>
            </IfcAxis2Placement3D>
            <IfcOwnerHistory id="i1640">
                <OwningUser>
                    <IfcPersonAndOrganization id="i1656">
                        <ThePerson>
                            <IfcPerson id="i1650">
                                <FamilyName>ddddddd</FamilyName>
                                <GivenName>dddddddd</GivenName>
                            </IfcPerson>
                        </ThePerson>
                        <TheOrganization>
                            <IfcOrganization xsi:nil="true" ref="i1652"/>
                        </TheOrganization>
                    </IfcPersonAndOrganization>
                </OwningUser>
                <OwningApplication>
                    <IfcApplication id="i1659">
                        <ApplicationDeveloper>
                            <IfcOrganization xsi:nil="true" ref="i1652"/>
                        </ApplicationDeveloper>
                        <Version>2015.0</Version>
                        <ApplicationFullName>Allplan</ApplicationFullName>
                        <ApplicationIdentifier>Allplan</ApplicationIdentifier>
                    </IfcApplication>
                </OwningApplication>
                <ChangeAction>added</ChangeAction>
                <CreationDate>1451984836</CreationDate>
            </IfcOwnerHistory>
            <IfcOrganization id="i1652">
                <Name>Nemetschek Allplan GmbH</Name>
            </IfcOrganization>
            <IfcProject id="i1641">
                <GlobalId>1flAB4Nyr0tfc3H9ITrNh4</GlobalId>
                <OwnerHistory>
                    <IfcOwnerHistory xsi:nil="true" ref="i1640"/>
                </OwnerHistory>
                <Name>giugio</Name>
                <RepresentationContexts cType="set">
                    <IfcGeometricRepresentationContext xsi:nil="true" ref="i1647"/>
                    <IfcGeometricRepresentationContext xsi:nil="true" ref="i1674"/>
                </RepresentationContexts>
                <UnitsInContext>
                    <IfcUnitAssignment id="i1678">
                        <Units cType="set">
                            <IfcSIUnit id="i1661">
                                <UnitType>lengthunit</UnitType>
                                <Prefix>milli</Prefix>
                                <Name>metre</Name>
                            </IfcSIUnit>
                            <IfcConversionBasedUnit id="i1665">
                                <Dimensions>
                                    <IfcDimensionalExponents id="i1664">
                                        <LengthExponent>0</LengthExponent>
                                        <MassExponent>0</MassExponent>
                                        <TimeExponent>0</TimeExponent>
                                        <ElectricCurrentExponent>0</ElectricCurrentExponent>
                                        <ThermodynamicTemperatureExponent>0</ThermodynamicTemperatureExponent>
                                        <AmountOfSubstanceExponent>0</AmountOfSubstanceExponent>
                                        <LuminousIntensityExponent>0</LuminousIntensityExponent>
                                    </IfcDimensionalExponents>
                                </Dimensions>
                                <UnitType>planeangleunit</UnitType>
                                <Name>DEGREE</Name>
                                <ConversionFactor>
                                    <IfcMeasureWithUnit id="i1663">
                                        <ValueComponent>
                                            <IfcPlaneAngleMeasure-wrapper>0.01745329252</IfcPlaneAngleMeasure-wrapper>
                                        </ValueComponent>
                                        <UnitComponent>
                                            <IfcSIUnit id="i1662">
                                                <UnitType>planeangleunit</UnitType>
                                                <Name>radian</Name>
                                            </IfcSIUnit>
                                        </UnitComponent>
                                    </IfcMeasureWithUnit>
                                </ConversionFactor>
                            </IfcConversionBasedUnit>
                            <IfcSIUnit xsi:nil="true" ref="i1666"/>
                            <IfcSIUnit xsi:nil="true" ref="i1667"/>
                        </Units>
                    </IfcUnitAssignment>
                </UnitsInContext>
            </IfcProject>
            </uos>
    </iso_10303_28>
    fin qui tutto bene gli elementi vengono deserializzati e in ifcProject me li ritrovo ,non ritrovo invece questo:
    codice:
    <OwnerHistory>
                    <IfcOwnerHistory xsi:nil="true" ref="i1640"/>
    che non viene sostituito.
    mi date una mano?
    grazie.

  2. #2
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    in particolare non espande gli elementi ref annidati , ho cercato molto su google ma non ho trovato la soluzione.
    si puo controllare in qualche modo la deserializzazione per "aggiustare" le referenze annidate?ho visto ad es che si possono iniettare servizi, mi dite che libro o che documentazione posso iniziare a leggere per capire.
    grazie.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.