I have a data access class:
using CompanyX.DataAccess.CompanyXTableAdapters;
namespace CompanyX.DataAccess
{
public class CompanyXDataAccess
{
#region Invoice
public CompanyX.InvoiceDataTable GetInvoiceByID(int ID)
{
InvoiceTableAdapter ta = new InvoiceTableAdapter();
using (ta.Connection = new SqlConnection(DB.GetReaderConnectionString()))
{
return ta.GetByID(ID);
}
}
public CompanyX.InvoiceDataTable GetInvoice(string userSID)
{
InvoiceTableAdapter ta = new InvoiceTableAdapter();
using (ta.Connection = new SqlConnection(DB.GetReaderConnectionString()))
{
return ta.Get(userSID);
}
}
public void DeleteInvoice(int ID)
{
InvoiceTableAdapter ta = new InvoiceTableAdapter();
using (ta.Connection = new SqlConnection(DB.GetWriterConnectionString()))
{
ta.Delete1(ID);
}
}
public void UpdateInvoice(Invoice m)
{
InvoiceTableAdapter ta = new InvoiceTableAdapter();
using (ta.Connection = new SqlConnection(DB.GetWriterConnectionString()))
{
ta.Update1(m.ID, ... n numbers of params ..., m.ModifiedBy);
}
}
#endregion
// more regions for modules come in here with CRUD and other queries
}
}
Is there any way I can improve this code without losing any performance?
Please note: I had to change names in code and trim screenshot for company privacy reasons.