Example #1
0
        public static void Serialize(this IMicroComponent component, XmlWriter writer)
        {
            if (component == null)
            {
                throw new ArgumentNullException(nameof(component));
            }
            var overrides = new XmlAttributeOverrides();

            overrides.Add(component.GetType(), new() { XmlRoot = new(Constants.MICRO_COMPONENT_ELEMENT_NAME) });
            var serializer = CachingXmlSerializerFactory.Create(component.GetType(), overrides);

            using (var microComponentXmlWriter = new MicroComponentXmlWriter(writer, component))
            {
                serializer.SerializeWithoutDefaultNamespaces(microComponentXmlWriter, component);
            }
        }
 public MicroPipelineComponentXmlWriter(XmlWriter writer, IMicroComponent component) : base(writer)
 {
     _component = component;
 }