title: Serializing properties
body: <p>I have searched everywhere in CF docs, FAQ's, Blog and SO entries but still can't understand why this model:</p>
  
  <pre><code>    &lt;cf:project defaultNamespace="Humanisme" xmlns:cf="http://www.softfluent.com/codefluent/2005/1" xmlns:cfx="http://www.softfluent.com/codefluent/modeler/2008/1" xmlns:cfom="http://www.softfluent.com/codefluent/producers.model/2005/1" xmlns:cfps="http://www.softfluent.com/codefluent/producers.sqlserver/2005/1" xmlns:cfsm="http://www.softfluent.com/codefluent/producers.servicemodel/2007/1" defaultKeyPropertyTypeName="int" defaultMaxLength="240" persistencePropertyNameFormat="{1}" createDefaultMethodForms="true" createDefaultApplication="false" createDefaultHints="false"&gt;
    &lt;cf:import path="Default.Surface.cfp" /&gt;
    &lt;cf:producer name="Business Object Model (BOM)" typeName="CodeFluent.Producers.CodeDom.CodeDomProducer, CodeFluent.Producers.CodeDom"&gt;
      &lt;cf:configuration compileWithVisualStudio="true" compile="false" codeDomProviderTypeName="CSharp" targetDirectory="..\Humanisme.classes" produceWebMembershipProvider="false" produceWebProfileProvider="false" produceWebBasicAuthenticationModule="false" cfx:targetProject="..\Humanisme.classes\Humanisme.classes.csproj" cfx:targetProjectLayout="Update"&gt;
        &lt;subProducer typeName="CodeFluent.Producers.ServiceModel.ServiceProducer, CodeFluent.Producers.ServiceModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1bb6d7cccf1045ec" compileWithVisualStudio="true" compile="false" codeDomProviderTypeName="CSharp" targetDirectory="..\Humanisme.webApi" silverlightTargetVersion="Unspecified" dataAnnotationsProductionModes="NoAnnotations, All" jsonOptions="EnableJson" outputName="HumanismeService" cfx:targetProject="..\Humanisme.webApi\Humanisme.webApi.csproj" cfx:targetProjectLayout="Update" produceProxy="False" /&gt;
      &lt;/cf:configuration&gt;
    &lt;/cf:producer&gt;
  
  (....)
  
  &lt;cf:entity name="EtapaVital" namespace="Humanisme" categoryPath="/Humanisme"&gt;
      &lt;cf:property name="Id" key="true" /&gt;
      &lt;cf:property name="Nom" /&gt;
      &lt;cf:property name="Idioma" typeName="{0}.EtapaVitalIdiomaCollection" relationPropertyName="Etapa" /&gt;
      &lt;cf:property name="Documents" typeName="{0}.DocumentCollection" relationPropertyName="EtapaVital" /&gt;
    &lt;/cf:entity&gt;
  </code></pre>
  
  <p>Renders to these serializing attributes: </p>
  
  <ol>
  <li>RowVersion and EntityState get the serializing attributes.</li>
  <li><p>EntityDisplayName does not.</p>
  
  <pre><code>[System.Runtime.Serialization.DataMemberAttribute(Order=2147483647)]
  private CodeFluent.Runtime.CodeFluentEntityState _entityState;
  
          public EtapaVital()
  
          [System.Runtime.Serialization.DataMemberAttribute()]
          public virtual string EntityKey
          {
              get
              {
                  return this.Id.ToString();
              }
              set
              {
                  this.Id = ((int)(ConvertUtilities.ChangeType(value, typeof(int), -1)));
              }
          }
  
          public virtual string EntityDisplayName
          {
              get
              {
                  return this.Nom;
              }
          }
  
          [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
          [System.ComponentModel.DataObjectFieldAttribute(false, true)]
          [System.ComponentModel.TypeConverterAttribute(typeof(CodeFluent.Runtime.Design.ByteArrayConverter))]
          [System.Runtime.Serialization.DataMemberAttribute()]
          public byte[] RowVersion
          {
              get
              {
                  return this._rowVersion;
              }
              set
              {
                  if (((value != null) 
                              &amp;&amp; (value.Length == 0)))
                  {
                      value = null;
                  }
                  this._rowVersion = value;
                  this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("RowVersion"));
              }
          }
  
          [System.ComponentModel.DefaultValueAttribute(((int)(-1)))]
          [System.Xml.Serialization.XmlElementAttribute(IsNullable=false, Type=typeof(int))]
          [System.ComponentModel.DataObjectFieldAttribute(true)]
         [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=100)]
          public int Id
          {
              get
              {
                  return this._id;
              }
              set
              {
                  if ((System.Collections.Generic.EqualityComparer&lt;int&gt;.Default.Equals(value, this._id) == true))
                  {
                      return;
                  }
                  int oldKey = this._id;
                  this._id = value;
                  try
                  {
                      this.OnCollectionKeyChanged(oldKey);
                  }
                  catch (System.ArgumentException )
                  {
                      this._id = oldKey;
                      return;
                  }
                  this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
                  this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("Id"));
              }
          }
  
          [System.ComponentModel.DefaultValueAttribute(default(string))]
          [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Type=typeof(string))]
          [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=200)]
          public string Nom
          {
              get
              {
                  return this._nom;
              }
              set
              {
                  this._nom = value;
                  this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Modified;
                  this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("Nom"));
              }
          }
  
          [System.Xml.Serialization.XmlIgnoreAttribute()]
          public Humanisme.EtapaVitalIdiomaCollection Idioma
          {
              get
              {
                  if ((this._idioma == null))
                  {
                      if (((this.Id == -1) 
                                  || (this.EntityState.Equals(CodeFluent.Runtime.CodeFluentEntityState.Created) == true)))
                      {
                          this._idioma = new Humanisme.EtapaVitalIdiomaCollection(this);
                          return this._idioma;
                      }
                      this._idioma = Humanisme.EtapaVitalIdiomaCollection.LoadByEtapa(this);
                  }
                  return this._idioma;
              }
          }
  
          [System.Xml.Serialization.XmlIgnoreAttribute()]
          public Humanisme.DocumentCollection Documents
          {
              get
              {
                  if ((this._documents == null))
                  {
                      if (((this.Id == -1) 
                                  || (this.EntityState.Equals(CodeFluent.Runtime.CodeFluentEntityState.Created) == true)))
                      {
                          this._documents = new Humanisme.DocumentCollection(null, this);
                          return this._documents;
                      }
                      this._documents = Humanisme.DocumentCollection.LoadByEtapaVital(this);
                  }
                  return this._documents;
              }
          }
  
  
          public virtual CodeFluent.Runtime.CodeFluentEntityState EntityState
          {
              get
              {
                  return this._entityState;
              }
              set
              {
                  if ((System.Collections.Generic.EqualityComparer&lt;CodeFluent.Runtime.CodeFluentEntityState&gt;.Default.Equals(value, this.EntityState) == true))
                  {
                      return;
                  }
                  if (((this._entityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted) 
                              &amp;&amp; (value == CodeFluent.Runtime.CodeFluentEntityState.Modified)))
                  {
                      return;
                  }
                  if (((this._entityState == CodeFluent.Runtime.CodeFluentEntityState.Created) 
                              &amp;&amp; (value == CodeFluent.Runtime.CodeFluentEntityState.Modified)))
                  {
                      return;
                  }
                  this._entityState = value;
                  this.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("EntityState"));
              }
          }
  </code></pre></li>
  </ol>
  
  <p>It seems there are not related property options on the model surface "Properties" window and I'm not able to find the xml tags or attributes in the cfp file.</p>
  
  <p>I will be very grateful if you can give me any clue or reference where to start learning the CodeFluent Model options that lead to these outputs in the classes.</p>
  
  <p>Thanks again, I'm really turning into a CodeFluent enthusiast!</p>