Skip to content

Commit

Permalink
Merge pull request #5006 from mtrutledge/issues/5005_AddJsonIgnore
Browse files Browse the repository at this point in the history
Add JsonIgnore Attribute
  • Loading branch information
valadas authored Feb 9, 2022
2 parents 30a3689 + b824a18 commit 5769549
Show file tree
Hide file tree
Showing 34 changed files with 321 additions and 141 deletions.
15 changes: 10 additions & 5 deletions DNN Platform/Library/Entities/BaseEntityInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ namespace DotNetNuke.Entities

using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Users;

using Newtonsoft.Json;

/// <summary>
/// BaseEntityInfo provides auditing fields for Core tables.
/// </summary>
Expand All @@ -31,31 +32,35 @@ protected BaseEntityInfo()
/// </summary>
/// <returns>An Integer.</returns>
[Browsable(false)]
[XmlIgnore]
[XmlIgnore]
[JsonIgnore]
public int CreatedByUserID { get; internal set; }

/// <summary>
/// Gets the CreatedOnDate.
/// </summary>
/// <returns>A DateTime.</returns>
[Browsable(false)]
[XmlIgnore]
[XmlIgnore]
[JsonIgnore]
public DateTime CreatedOnDate { get; private set; }

/// <summary>
/// Gets the LastModifiedByUserID.
/// </summary>
/// <returns>An Integer.</returns>
[Browsable(false)]
[XmlIgnore]
[XmlIgnore]
[JsonIgnore]
public int LastModifiedByUserID { get; internal set; }

/// <summary>
/// Gets the LastModifiedOnDate.
/// </summary>
/// <returns>A DateTime.</returns>
[Browsable(false)]
[XmlIgnore]
[XmlIgnore]
[JsonIgnore]
public DateTime LastModifiedOnDate { get; private set; }

/// <summary>
Expand Down
31 changes: 21 additions & 10 deletions DNN Platform/Library/Entities/Content/ContentItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace DotNetNuke.Entities.Content
using DotNetNuke.Entities.Content.Taxonomy;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.FileSystem;
using Newtonsoft.Json;

/// <summary>
/// The ContentItem class which itself inherits from BaseEntityInfo paves the way for easily adding support for taxonomy,
Expand Down Expand Up @@ -85,7 +86,8 @@ public ContentItem()
/// </summary>
/// <value>metadata collection.</value>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public NameValueCollection Metadata
{
get
Expand All @@ -99,7 +101,8 @@ public NameValueCollection Metadata
/// </summary>
/// <value>Terms Collection.</value>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public List<Term> Terms
{
get
Expand All @@ -112,7 +115,8 @@ public List<Term> Terms
/// Gets files that are attached to this ContentItem.
/// </summary>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public List<IFileInfo> Files
{
get { return this._files ?? (this._files = AttachmentController.DeserializeFileInfo(this.Metadata[AttachmentController.FilesKey]).ToList()); }
Expand All @@ -122,7 +126,8 @@ public List<IFileInfo> Files
/// Gets video files attached to this ContentItem.
/// </summary>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public List<IFileInfo> Videos
{
get { return this._videos ?? (this._videos = AttachmentController.DeserializeFileInfo(this.Metadata[AttachmentController.VideoKey]).ToList()); }
Expand All @@ -132,7 +137,8 @@ public List<IFileInfo> Videos
/// Gets images associated with this ContentItem.
/// </summary>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public List<IFileInfo> Images
{
get { return this._images ?? (this._images = AttachmentController.DeserializeFileInfo(this.Metadata[AttachmentController.ImageKey]).ToList()); }
Expand All @@ -145,7 +151,8 @@ public List<IFileInfo> Images
/// The content item id.
/// </value>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int ContentItemId { get; set; }

/// <summary>
Expand Down Expand Up @@ -174,7 +181,8 @@ public List<IFileInfo> Images
/// </value>
/// <see cref="ContentType"/>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int ContentTypeId { get; set; }

/// <summary>
Expand All @@ -184,7 +192,8 @@ public List<IFileInfo> Images
/// <c>true</c> if indexed; otherwise, <c>false</c>.
/// </value>
[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public bool Indexed { get; set; }

/// <summary>
Expand Down Expand Up @@ -226,7 +235,8 @@ public string ContentTitle
/// <value>
/// The Content Workflow State ID.
/// </value>
[XmlIgnore]
[XmlIgnore]
[JsonIgnore]
public int StateID { get; set; }

/// <summary>
Expand All @@ -238,7 +248,8 @@ public string ContentTitle
/// <remarks>
/// If you derive class has its own key id, please override this property and set the value to your own key id.
/// </remarks>
[XmlIgnore]
[XmlIgnore]
[JsonIgnore]
public virtual int KeyID
{
get
Expand Down
37 changes: 25 additions & 12 deletions DNN Platform/Library/Entities/Content/Taxonomy/Term.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace DotNetNuke.Entities.Content.Taxonomy
using DotNetNuke.Entities.Content.Common;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Security;
using Newtonsoft.Json;

/// <summary>
/// Major class of Taxonomy.
Expand Down Expand Up @@ -117,7 +118,8 @@ public Term(string name, string description, int vocabularyId)
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public List<Term> ChildTerms
{
get
Expand All @@ -132,7 +134,8 @@ public List<Term> ChildTerms
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public bool IsHeirarchical
{
get
Expand All @@ -142,7 +145,8 @@ public bool IsHeirarchical
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int Left
{
get
Expand All @@ -152,7 +156,8 @@ public int Left
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int Right
{
get
Expand All @@ -162,7 +167,8 @@ public int Right
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public List<string> Synonyms
{
get
Expand All @@ -172,7 +178,8 @@ public List<string> Synonyms
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public Vocabulary Vocabulary
{
get
Expand All @@ -187,7 +194,8 @@ public Vocabulary Vocabulary
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int VocabularyId
{
get
Expand All @@ -197,7 +205,8 @@ public int VocabularyId
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public string Description
{
get
Expand All @@ -212,7 +221,8 @@ public string Description
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public string Name
{
get
Expand All @@ -237,7 +247,8 @@ public string Name
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int? ParentTermId
{
get
Expand All @@ -252,7 +263,8 @@ public int? ParentTermId
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int TermId
{
get
Expand All @@ -267,7 +279,8 @@ public int TermId
}

[XmlIgnore]
[ScriptIgnore]
[ScriptIgnore]
[JsonIgnore]
public int Weight
{
get
Expand Down
Loading

0 comments on commit 5769549

Please sign in to comment.