Re: Factory pattern and building object



<opamail1-googlenews@xxxxxxxxx> wrote in message
news:1127767570.752816.225950@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I am creating a FlowChart type GUI application which has several
> diagram items. I have a DiagramItemFactory which creates concrete
> diagram item objects. I call this factory to create diagram items at
> runtime via drag and drop, insert or other. Then I serialize my diagram
> to an XML file. Everything is ok so far.

> My problem is when I open the file a go through the diagram items
> defined in the file, I want to the DiagramItemFactory again to create
> the diagram items for the diagram, but the problem is that
> the factory only creates the default diagram items and the file
> also contains size, color, coordinate and other properties.

Hi Opa,

If you are using the serialization capabilities of the framework, it will
serialize the concrete object and all public properties, not just the
generic object. How are you serializing your object? Also, your snippet
shows the factory but not the definition of the child objects. The
attributes that you use in the code of the objects will determine both how
the objects will be serialized and how they will be deserialized.

See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml01202003.asp

Also, you will get much more specific help on your C# problems by posting to
the microsoft.public.dotnet.languages.csharp newsgroup.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--


.



Relevant Pages

  • Re: Factory pattern and building object
    ... If you serialize concrete object A, ... Note that the builder is a creational pattern. ... > My issue is building the diagram from a file containing diagram items ...
    (comp.object)
  • Re: Factory pattern and building object
    ... > diagram item objects. ... I call this factory to create diagram items at ... Then I serialize my diagram ...
    (comp.object)
  • Re: Factory pattern and building object
    ... I'm using my own serialization, ... My issue is building the diagram from a file containing diagram items ... a builder pattern, but looking at the constructs of this pattern, there ... I call this factory to create diagram items at ...
    (comp.object)