dd4t / DD4T.Core

DD4T Core delivery framework for Microsoft.NET
Apache License 2.0
4 stars 14 forks source link

Too many XmlIgnore attributes on ContentModel classes #80

Open quirijnslings opened 8 years ago

quirijnslings commented 8 years ago

In Field: [XmlIgnore] public List Keywords { get { return KeywordValues; } set { KeywordValues = value; } }

Careful: there may be more examples of this in the ContentModel.cs!

anatolii-lysenko commented 8 years ago

Hello,

I've started with dd4t 2.0 upgrade and found out a bug that breaks backward compatibility. It reproduces only in case of 2 or more TBBs in template. In 1.31 in Field class of ContentModel dll there was Keywords list property and in 2.0 version that property wraps another KeywordValules property. During serialization/deserialization process XML changes and Keywords collection remains empty. So instead of <Keywords><Keyword> ... </Keyword></Keywords> the following is rendering <KeywordValues />

I've tried to remove XmlIgnore from KeywordValues property and got the XML that contains keywords information but with new node names.

Looking into removing KeywordValues property and leaving only Keywords one and refactoring all the projects to use it.

Regards, Anatolii Lysenko

code-monkee commented 8 years ago

This is an urgent issue for me as well. Looking at Anatolli's comment, I attempted to simply remove the [XMLIgnore] annotation from

    [XmlIgnore]
    public List<Keyword> Keywords
    {...}

    [XmlIgnore]
    IList<IKeyword> IField.Keywords
    {...}

    [XmlIgnore]
    IList<IKeyword> IField.KeywordValues
    {...}

This seemed to work. Is they any further issues that this could possibly cause? Should I submit this as a pull request? Hoping to avoid having to think about going into production with a customized version of a DD4T library.

As a sidenote when trying to build the DD4T.Model solution from the released version, I found that there is a circular reference between DD4T.ContentModel and DD4T.Serialization. Not sure if this has been fixed in alpha versions. I cut and pasted a dll from my already downloaded nuGet package to encourage it to build.

Let me know if there's any further help I can provide.

Jason Kaufmann

anatolii-lysenko commented 8 years ago

Hi Jason, Another issue you may find is DCPs. New version requires all the DCPs published as CP and not just component. In PageFactory.LoadComponentModelsFromComponentPresentationFactory there is a line where ComponentTemplate object is being reassigned. It broke our code in a few places because we use information about CT. I commented it out and everything is working fine now.

Anatolii