private DataSet SelectUserRoles(string user) { DBCommandWrapper cmd = userDb.GetStoredProcCommandWrapper("GetRolesByName"); cmd.AddInParameter("name", DbType.String, user); return(userDb.ExecuteDataSet(cmd)); }
/// <summary> /// Removes the item identified by the key from the database /// </summary> /// <param name="storageKey">Key of CacheItem to remove.</param> /// <remarks>Exceptions thrown depend on the implementation of the underlying database.</remarks> protected override void Remove(int storageKey) { DBCommandWrapper deleteCommand = database.GetStoredProcCommandWrapper("RemoveItem"); deleteCommand.AddInParameter("@partitionName", DbType.String, partitionName); deleteCommand.AddInParameter("@storageKey", DbType.Int32, storageKey); database.ExecuteNonQuery(deleteCommand); }
private void DeleteProfile(string userName, Data.Database securityDb, IDbTransaction transaction) { DBCommandWrapper cmd = securityDb.GetStoredProcCommandWrapper(SPDeleteProfile); cmd.AddInParameter("userName", DbType.String, userName); securityDb.ExecuteNonQuery(cmd, transaction); }
private void ExecuteStoredProcedure(LogEntry logEntry) { DatabaseSinkData databaseSinkData = loggingConfigurationView.GetSinkData(ConfigurationName) as DatabaseSinkData; DatabaseProviderFactory factory = new DatabaseProviderFactory(loggingConfigurationView.ConfigurationContext); Data.Database db = factory.CreateDatabase(databaseSinkData.DatabaseInstanceName); DBCommandWrapper cmd = db.GetStoredProcCommandWrapper(databaseSinkData.StoredProcName); cmd.AddInParameter("eventID", DbType.Int32, logEntry.EventId); cmd.AddInParameter("category", DbType.String, logEntry.Category); cmd.AddInParameter("priority", DbType.Int32, logEntry.Priority); cmd.AddInParameter("severity", DbType.String, logEntry.Severity.ToString()); cmd.AddInParameter("title", DbType.String, logEntry.Title); cmd.AddInParameter("timestamp", DbType.DateTime, logEntry.TimeStamp); cmd.AddInParameter("machineName", DbType.String, logEntry.MachineName); cmd.AddInParameter("AppDomainName", DbType.String, logEntry.AppDomainName); cmd.AddInParameter("ProcessID", DbType.String, logEntry.ProcessId); cmd.AddInParameter("ProcessName", DbType.String, logEntry.ProcessName); cmd.AddInParameter("ThreadName", DbType.String, logEntry.ManagedThreadName); cmd.AddInParameter("Win32ThreadId", DbType.String, logEntry.Win32ThreadId); cmd.AddInParameter("message", DbType.String, logEntry.Message); cmd.AddInParameter("formattedmessage", DbType.String, FormatEntry(logEntry)); db.ExecuteNonQuery(cmd); }
private void InsertProfile(string userName, byte[] serializedProfile, Data.Database securityDb, IDbTransaction transaction) { DBCommandWrapper cmd = securityDb.GetStoredProcCommandWrapper(SPAddProfile); cmd.AddInParameter("userName", DbType.String, userName); cmd.AddInParameter("profile", DbType.Binary, serializedProfile); securityDb.ExecuteNonQuery(cmd, transaction); }
private byte[] LoadProfile(string userName) { Data.Database securityDb = GetSecurityDatabase(); DBCommandWrapper cmd = securityDb.GetStoredProcCommandWrapper(SPGetProfile); cmd.AddInParameter("userName", DbType.String, userName); cmd.AddOutParameter("profile", DbType.Binary, maxProfileLength); securityDb.ExecuteNonQuery(cmd); object profile = cmd.GetParameterValue("profile"); return(profile == DBNull.Value ? null : (byte[])profile); }