/// <summary> /// /// </summary> /// <param name="daScopeContext"></param> /// <param name="dataAdapterCommand"></param> /// <param name="commandWrappersDataAdapter"></param> /// <returns></returns> internal static DbCommand GetDbCommand(DaScopeContext daScopeContext, DataAdapterCommand dataAdapterCommand, Dictionary <DataAdapterCommand, DbCommandWrapper> commandWrappersDataAdapter) { if (commandWrappersDataAdapter.ContainsKey(dataAdapterCommand)) { DbCommandWrapper commandWrapper = commandWrappersDataAdapter[dataAdapterCommand]; return(commandWrapper.GetDbCommand(daScopeContext)); } return(null); }
/// <summary> /// Update commands of DataAdater if the instance already exists /// </summary> /// <param name="dataAdapterCommand"></param> /// <param name="commandWrapper"></param> private void UpdateCommandOfDataAdapter(DataAdapterCommand dataAdapterCommand, DbCommandWrapper commandWrapper) { if (_dataAdapter != null) { switch (dataAdapterCommand) { case DataAdapterCommand.Select: DataAdapter.SelectCommand = commandWrapper.GetDbCommand(DaScopeContext); break; case DataAdapterCommand.Insert: DataAdapter.InsertCommand = commandWrapper.GetDbCommand(DaScopeContext); break; case DataAdapterCommand.Update: DataAdapter.UpdateCommand = commandWrapper.GetDbCommand(DaScopeContext); break; case DataAdapterCommand.Delete: DataAdapter.DeleteCommand = commandWrapper.GetDbCommand(DaScopeContext); break; } } }