/// <summary> /// Initializes a new instance of IdentityMap. /// </summary> /// <param name="owner"><see cref="T:FieldMap"/> this identity belongs to.</param> /// <param name="format"><see cref="T:IdentityFormat"/> of the identity.</param> /// <param name="increment"><see cref="T:IdentityIncrement"/> of the identity.</param> public IdentityMap( FieldMap owner, IdentityFormat format, IdentityIncrement increment ) { this.Owner = owner; this.Format = format; this.Increment = increment; if ( this.Format == IdentityFormat.Guid ) { this.UnsavedValue = new Guid(); } else if ( this.Format == IdentityFormat.Integer ) { this.UnsavedValue = 0; } else if ( this.Format == IdentityFormat.String ) { this.UnsavedValue = String.Empty; } }
public static Identity From(string data, IdentityFormat format) { return(format.Deserialize(data)); }
public string To(IdentityFormat format) { return(format.Serialize(this)); }