simplified version using subtype DAL instead of multiple. aggregate class no longer needed, but requires virtual methods for add/update
This commit is contained in:
@ -5,7 +5,7 @@ namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public class EFSettlementAttemptDataAccess : ISettlementAttemptDataAccess
|
||||
{
|
||||
public bool AddAttempt(SettlementAttempt attempt)
|
||||
public virtual bool AddAttempt(SettlementAttempt attempt)
|
||||
{
|
||||
// 1. create attempt in SQL using entity framework
|
||||
// 2. update the "Id" property/PK of attempt upon insertion
|
||||
|
@ -3,10 +3,13 @@ using System;
|
||||
|
||||
namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public class QuickBaseSettlementAttemptDataAccess : ISettlementAttemptDataAccess
|
||||
public class QuickBaseSettlementAttemptDataAccess : EFSettlementAttemptDataAccess
|
||||
{
|
||||
public bool AddAttempt(SettlementAttempt attempt)
|
||||
public override bool AddAttempt(SettlementAttempt attempt)
|
||||
{
|
||||
// save to SQL first
|
||||
base.AddAttempt(attempt);
|
||||
|
||||
// 1. create attempt in QuickBase ("Id" SQL PK should already be populated)
|
||||
// 2. update the "RecordId" property/PK of attempt upon insertion
|
||||
// 3. return if operation is successful
|
||||
@ -18,8 +21,5 @@ namespace BinaryDad.AggregateDal
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// NOTE: we have no need to retrieve a record from QB, as it will come from SQL
|
||||
public SettlementAttempt GetAttempt(int recordId) => null;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
using BinaryDad.AggregateDal.Models;
|
||||
using System.Linq;
|
||||
|
||||
namespace BinaryDad.AggregateDal
|
||||
{
|
||||
public class SettlementAttemptDataAccess : AggregateDataAccess<ISettlementAttemptDataAccess>, ISettlementAttemptDataAccess
|
||||
{
|
||||
public bool AddAttempt(SettlementAttempt attempt) => Invoke(d => d.AddAttempt(attempt));
|
||||
public SettlementAttempt GetAttempt(int recordId) => Invoke(d => d.GetAttempt(recordId));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user