internal static Result <T> InsertCascadeGo <T>(Assembly client, DbRow row, ConnectBy connectBy) where T : DbRow { var name = Text.NotAvailable; if (row == null) { throw new QueryTalkException("Crud", QueryTalkExceptionType.ArgumentNull, "row = null", Text.Method.InsertCascadeGo); } Crud.CheckTable(row, Text.Method.InsertCascadeGo); try { var map = DbMapping.TryGetNodeMap(row); name = map.Name.Sql; var scopeOption = GetTransactionScopeOption(client, map, connectBy); if (Transaction.Current != null) { scopeOption.IsolationLevel = Transaction.Current.IsolationLevel; } using (var scope = new TransactionScope(TransactionScopeOption.Required, scopeOption)) { Crud.InsertGo <T>(client, row, false, connectBy); ((INode)row).InsertGraph(client, connectBy); scope.Complete(); } return(new Result <T>(true, -1)); } catch (QueryTalkException) { throw; } catch (System.Exception ex) { throw Crud.ClrException(ex, name, Text.Method.InsertCascadeGo); } }
/// <summary> /// Inserts the specified row in the database. /// </summary> /// <typeparam name="T">The type of the row object.</typeparam> /// <param name="row">The row to insert.</param> /// <param name="identityInsert">If true, then the explicit value can be inserted into the identity column of a table.</param> public Result <T> InsertGo <T>(T row, bool identityInsert = false) where T : DbRow { return(PublicInvoker.Call <Result <T> >(Assembly.GetCallingAssembly(), (ca) => Crud.InsertGo <T>(ca, row, identityInsert, this))); }