From b37433e6de3a29c21fcd97a06552ec5e832a6c94 Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Wed, 14 Oct 2020 12:43:46 -0400 Subject: [PATCH] tweaks --- .../Helpers/CreditorHelper.cs | 10 +++++----- COA.EnterpriseServices.Sandbox/Program.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs b/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs index 8fc5041..ad70de3 100644 --- a/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs +++ b/COA.EnterpriseServices.DataAccess/Helpers/CreditorHelper.cs @@ -8,10 +8,10 @@ namespace COA.EnterpriseServices.DataAccess.Helpers // It allows for multiple DataAccessManagers to be used however needed by the helper public class CreditorHelper { - private static DataAccessManager creditorDataAccess; - private static DataAccessManager settlementAttemptDataAccess; + private static readonly DataAccessManager creditorDataAccess; + private static readonly DataAccessManager settlementAttemptDataAccess; - public CreditorHelper() + static CreditorHelper() { creditorDataAccess = new DataAccessManager(); settlementAttemptDataAccess = new DataAccessManager(); @@ -19,12 +19,12 @@ namespace COA.EnterpriseServices.DataAccess.Helpers public Creditor GetCreditor(int id) { - return creditorDataAccess.Invoke(d => d.Get(d => d.Id == id).FirstOrDefault()); + return creditorDataAccess.Invoke(d => d.Get(d => d.Id == id)?.FirstOrDefault()); } public SettlementAttempt GetSettlementAttempt(int id) { - return settlementAttemptDataAccess.Invoke(d => d.Get(d => d.Id == id).FirstOrDefault()); + return settlementAttemptDataAccess.Invoke(d => d.Get(d => d.Id == id)?.FirstOrDefault()); } public ICollection FindByName(string name) diff --git a/COA.EnterpriseServices.Sandbox/Program.cs b/COA.EnterpriseServices.Sandbox/Program.cs index 4a271ff..d2a9ca3 100644 --- a/COA.EnterpriseServices.Sandbox/Program.cs +++ b/COA.EnterpriseServices.Sandbox/Program.cs @@ -7,8 +7,8 @@ namespace COA.EnterpriseServices.Sandbox { private static void Main(string[] args) { - ClientStuff(); - //CreditorStuff(); + //ClientStuff(); + CreditorStuff(); } private static void CreditorStuff()