public int Update <T>(RepositoryRecord <T> item, string userName) where T : RepositoryRecord <T>, new() { if (userName == null) { throw new ArgumentNullException("userName"); } int result = 0; if (item.IsDirty) { QueryCommand cmd = ActiveHelper <T> .GetUpdateCommand(item, userName); result = DataService.ExecuteQuery(cmd); } item.DirtyColumns.Clear(); item.MarkOld(); item.MarkClean(); return(result); }
/// <summary> /// Returns a UPDATE QueryCommand object used to generate SQL. /// </summary> /// <param name="userName">An optional username to be used if audit fields are present</param> /// <returns></returns> public QueryCommand GetUpdateCommand(string userName) { return(ActiveHelper <T> .GetUpdateCommand(this, userName)); }
/// <summary> /// Gets the update command. /// </summary> /// <param name="item">The item.</param> /// <param name="userName">Name of the user.</param> /// <returns></returns> public static QueryCommand GetUpdateCommand(ItemType item, string userName) { return(ActiveHelper <ItemType> .GetUpdateCommand(item, userName)); }