This project is read-only.

New properties of post class would not serialize

Jan 26, 2011 at 3:02 AM

Hi All!

I have modified the blogengine core to add new properties to the post class. And I have modified a few pages on the web site to show the new properties of the posts. So far so good!

But I noticed that the xml files in the \App_Data\posts are missing the new propeties.

I am guessing that the new properties are getting stored in cache correctly thus the posts are being displayed with the new properties. But when I modify the core and upload the new core files in the \bin directory, I lose all the new properties of my posts. But when I edit each post ( I only have two) to set the new properties, the new properties of the posts will display correctly but not persist in the xml file.

So the question really is "What else am I missing in order to correctly serialize the post class to the xml file?


Jan 26, 2011 at 7:42 AM

Sounds like you're close.  In the BE core, /Providers/XmlProvider folder is a file named Posts.cs.  Two changes are needed.  To include the new properties in InsertPost(), and also include them in SelectPost().  It's not necessary to update UpdatePost() as you can see in the code since UpdatePost() simply calls InsertPost().

Jan 26, 2011 at 1:06 PM


I ended up having to modify the following 5 files in the core:

API\MetaWeblog\MetaWeblogHandler.cs - added the public properties. Also the GetPost and EditPost functions.
API\MetaWeblog\MWAPost.cs - added the new public properties.
Json\JsonPosts.cs - the GetPosts function.
Post.cs - added the new private and public properties. Also the public Post class constructor.
Providers\XmlProvider\Posts.cs - the InserPost function.

I am using XML Provider. You might have to modify the other file for the other providers.