0
的參考serialized-對象引用。這是我裝修我的等級和屬性的方式。WCF公共財產 - 沒有得到未設置爲我有一個問題,我有私人領域和公共財產的對象 - 錯誤
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization;
using System.Xml.Serialization;
[DataContract]
[KnownType(typeof(XDocument))]
public abstract class DocumentBase
{
#region Public Contructors
/// <summary>
/// Initialises a new instance of the DocumentBase class
/// </summary>
protected DocumentBase()
{
Id = Guid.NewGuid();
Roles = new List<string>();
}
#endregion
#region Private Fields
/// <summary>
/// Holds the filename of the document
/// </summary>
[DataMember]
private string fileName;
private IFileNameCleaner fileNameCleaner;
#endregion
#region Protected Properties
protected IFileNameCleaner FileNameCleaner
{
get
{
return fileNameCleaner;
}
set
{
fileNameCleaner = value;
}
}
#endregion
#region Public Properties
[DataMember]
public string FileName
{
get
{
string newFileName = this.fileName;
if (FileNamePrefix > 0)
{
newFileName = FileNamePrefix + "_" + fileName;
}
return fileNameCleaner.FileName(newFileName);
}
private set
{
fileName = value;
}
}
錯誤:
文件名是沒有得到序列化,任何人都可以告訴我被遺漏了什麼?
幾乎'NullReferenceException'的所有情況都是一樣的。請參閱「[什麼是.NET中的NullReferenceException?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-in-net)」的一些提示。 –