/// <summary> /// Sets the name of the column to use for row version control purposes. If the name is /// null then row version control is not enforced. /// </summary> /// <param name="name">A dynamic lambda expression that resolves into the name of the /// column.</param> /// <param name="customize">If not null the delegate to invoke with the column as its /// argument in order to permit its customization, if needed.</param> /// <returns>This instance to permit a fluent chaining syntax.</returns> public MapVersionColumn <T> SetName(Func <dynamic, object> name, Action <MapColumn <T> > customize = null) { _Column = Map.Columns.Add(name, raise: false); _Column.Required = true; _Name = _Column.Name; if (customize != null) { customize(_Column); } return(this); }
/// <summary> /// Removes the given entry from this collection. Returns true if the member has been /// removed, or false otherwise. /// </summary> /// <param name="entry">The entry to remove.</param> /// <returns>True if the entry has been removed, or false otherwise.</returns> public bool Remove(MapColumn <T> entry) { if (IsDisposed) { throw new ObjectDisposedException(this.ToString()); } if (Map.IsDisposed) { throw new ObjectDisposedException(Map.ToString()); } if (Map.IsValidated) { throw new InvalidOperationException("Map '{0}' is validated.".FormatWith(Map)); } bool r = entry == null ? false : _List.Remove(entry); if (r) { entry.OnDispose(); } return(r); }
/// <summary> /// Returns a new instance that is a copy of the original one, but associated with /// the given target. /// </summary> /// <param name="target">The target the new instance with be associated with.</param> /// <returns>A new instance.</returns> internal MapColumn <T> Clone(DataMap <T> target) { var cloned = new MapColumn <T>(target, Name); OnClone(cloned); return(cloned); }
/// <summary> /// Invoked when disposing this instance. /// </summary> internal protected virtual void OnDispose() { _Map = null; _Column = null; _ValueToString = null; }