public override RDFStore RemoveQuadruplesByContext(RDFContext contextResource)
{
if (contextResource != null) {
//Create command
var command = new SqlCommand("DELETE FROM [dbo].[Quadruples] WHERE [ContextID] = @CTXID", this.Connection);
command.Parameters.Add(new SqlParameter("CTXID", SqlDbType.BigInt));
//Valorize parameters
command.Parameters["CTXID"].Value = contextResource.PatternMemberID;
try {
//Open connection
this.Connection.Open();
//Prepare command
command.Prepare();
//Open transaction
command.Transaction = this.Connection.BeginTransaction();
//Execute command
command.ExecuteNonQuery();
//Close transaction
command.Transaction.Commit();
//Close connection
this.Connection.Close();
}
catch (Exception ex) {
//Rollback transaction
command.Transaction.Rollback();
//Close connection
this.Connection.Close();
//Propagate exception
throw new RDFStoreException("Cannot delete data from SQL Server store because: " + ex.Message, ex);
}
}
return this;
}