×

Notice

The forum is in read only mode.
×
Getting new Releases

To get notified on new releases you may follow us on twitter @expandframework or subscribe in our main RSS feed.

Topic-icon IO ExportEngine - make it useable without persistent SerializationConfiguration

  • Johannes
  • Johannes's Avatar Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
More
1 year 2 months ago #11418 by Johannes
Hi Tolis!

IO Module uses some very nice interfaces regarding serialization configuration, but unfortuneately with the current implementation it doesn't allow ExportManager to be used with custom serialization configuration objects that are not built on XPObject (f.e. I want to use/ already use POCOs instead where the whole configuration is made up just in code).

Fortuneately this can be changed with some minor changes to SerializeClassInfoGraphNodesCalculator (see code below). For someone using it the way described above it is to mention that one has to provide a complete serialization configuration (that is a ISserializationConfiguration for every type that gets exported) as ClassInfoGraphNodeBuilder still works only with an XPO based SerializationConfiguration. For everyone else everything should stay the same as before (except the code a bit easier to understand).

It would be nice if it could be changed as then I could replace my current code fork.

Regards,
Johannes

Here are my suggested replacement methods for SerializeClassInfoGraphNodesCalculator:
        ISerializationConfiguration GetConfiguration(Type type) {
            var configuration = _serializationConfigurationGroup.Configurations.FirstOrDefault(config => config.TypeToSerialize == type);

            if (configuration == null){
                configuration = _objectSpace.Create<ISerializationConfiguration>();
                configuration.SerializationConfigurationGroup = _serializationConfigurationGroup;
                configuration.TypeToSerialize = type;
                new ClassInfoGraphNodeBuilder().Generate(configuration);
            }
            return configuration;
        }

        IEnumerable<IClassInfoGraphNode> GetSerializedClassInfoGraphNodes(ISerializationConfiguration serializationConfiguration)
        {
            return serializationConfiguration.SerializationGraph.Where(
                    node => (node.NodeType == NodeType.Simple && node.SerializationStrategy != SerializationStrategy.DoNotSerialize) ||
                            node.NodeType != NodeType.Simple).OrderBy(graphNode => graphNode.NodeType);
        }
More
1 year 2 months ago #11419 by Tolis
Thanks for posting Johannes, I will review and let you know if I have questions.

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
More
1 year 2 months ago #11424 by Tolis
your fix is included in 17.2.5.1

Thanks!

To get notified on new releases follow us on twitter @expandframework or subscribe RSS feed. I am also available @tolisss . Also see How to debug eXpand
The following user(s) said Thank You: Johannes
Moderators: expand
Time to create page: 0.387 seconds