private void Child_Update() { if (!IsDirty) { return; } var dto = new F02_ContinentDto(); dto.Continent_ID = Continent_ID; dto.Continent_Name = Continent_Name; using (var dalManager = DalFactoryParentLoadSoftDelete.GetManager()) { var args = new DataPortalHookArgs(dto); OnUpdatePre(args); var dal = dalManager.GetProvider <IF02_ContinentDal>(); using (BypassPropertyChecks) { var resultDto = dal.Update(dto); args = new DataPortalHookArgs(resultDto); } OnUpdatePost(args); // flushes all pending data operations FieldManager.UpdateChildren(this); } }
/// <summary> /// Factory method. Loads a <see cref="F02_Continent"/> object from the given F02_ContinentDto. /// </summary> /// <param name="data">The <see cref="F02_ContinentDto"/>.</param> /// <returns>A reference to the fetched <see cref="F02_Continent"/> object.</returns> internal static F02_Continent GetF02_Continent(F02_ContinentDto data) { F02_Continent obj = new F02_Continent(); obj.Fetch(data); obj.LoadProperty(F03_SubContinentObjectsProperty, new F03_SubContinentColl()); return(obj); }
/// <summary> /// Loads a <see cref="F02_Continent"/> object from the given <see cref="F02_ContinentDto"/>. /// </summary> /// <param name="data">The F02_ContinentDto to use.</param> private void Fetch(F02_ContinentDto data) { // Value properties LoadProperty(Continent_IDProperty, data.Continent_ID); LoadProperty(Continent_NameProperty, data.Continent_Name); var args = new DataPortalHookArgs(data); OnFetchRead(args); }
private F02_ContinentDto Fetch(SafeDataReader dr) { var f02_Continent = new F02_ContinentDto(); // Value properties f02_Continent.Continent_ID = dr.GetInt32("Continent_ID"); f02_Continent.Continent_Name = dr.GetString("Continent_Name"); return(f02_Continent); }
/// <summary> /// Factory method. Loads a <see cref="F02_Continent"/> object from the given F02_ContinentDto. /// </summary> /// <param name="data">The <see cref="F02_ContinentDto"/>.</param> /// <returns>A reference to the fetched <see cref="F02_Continent"/> object.</returns> internal static F02_Continent GetF02_Continent(F02_ContinentDto data) { F02_Continent obj = new F02_Continent(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(data); obj.LoadProperty(F03_SubContinentObjectsProperty, F03_SubContinentColl.NewF03_SubContinentColl()); obj.MarkOld(); return(obj); }
/// <summary> /// Inserts a new F02_Continent object in the database. /// </summary> /// <param name="f02_Continent">The F02 Continent DTO.</param> /// <returns>The new <see cref="F02_ContinentDto"/>.</returns> public F02_ContinentDto Insert(F02_ContinentDto f02_Continent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("AddF02_Continent", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID", f02_Continent.Continent_ID).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@Continent_Name", f02_Continent.Continent_Name).DbType = DbType.String; cmd.ExecuteNonQuery(); f02_Continent.Continent_ID = (int)cmd.Parameters["@Continent_ID"].Value; } } return(f02_Continent); }
/// <summary> /// Updates in the database all changes made to the F02_Continent object. /// </summary> /// <param name="f02_Continent">The F02 Continent DTO.</param> /// <returns>The updated <see cref="F02_ContinentDto"/>.</returns> public F02_ContinentDto Update(F02_ContinentDto f02_Continent) { using (var ctx = ConnectionManager <SqlConnection> .GetManager("DeepLoad")) { using (var cmd = new SqlCommand("UpdateF02_Continent", ctx.Connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Continent_ID", f02_Continent.Continent_ID).DbType = DbType.Int32; cmd.Parameters.AddWithValue("@Continent_Name", f02_Continent.Continent_Name).DbType = DbType.String; var rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new DataNotFoundException("F02_Continent"); } } } return(f02_Continent); }