public ChallengeStatus(ChallengeStatusDb d) { // this.UniqueID = d.RowKey; this.CustomerID = d.CustomerID; this.ChallengeID = d.ChallengeID; this.Status = d.Status; this.ChallengeOriginatorCustomerID = d.ChallengeOriginatorCustomerID; this.Customer = null; }
private void CoreAddOrUpdate(ChallengeStatus value, bool Add=false) { ChallengeStatusDb sourceCust = new ChallengeStatusDb(value); ChallengeStatusDb targetCust = new ChallengeStatusDb(value); ChallengeStatusDb chal = new ChallengeStatusDb(value); targetCust.PartitionKey = "Cust" + value.CustomerID; sourceCust.PartitionKey = "SourceCust" + value.ChallengeOriginatorCustomerID; chal.PartitionKey = "Chal" + value.ChallengeID; if (Add) context.AddObject(TableName, sourceCust); else { context.AttachTo(TableName, sourceCust, null); context.UpdateObject(sourceCust); } if (Add) context.AddObject(TableName, targetCust); else { context.AttachTo(TableName, targetCust, null); context.UpdateObject(targetCust); } if (Add) context.AddObject(TableName, chal); else { context.AttachTo(TableName, chal, null); context.UpdateObject(chal); } context.SaveChangesWithRetries(); context.Detach(sourceCust); context.Detach(targetCust); context.Detach(chal); }
private void CoreAddOrUpdate(ChallengeStatus value, bool Add=false) { ChallengeStatusDb targetCust = new ChallengeStatusDb(value); ChallengeStatusDb chal = new ChallengeStatusDb(value); string targetCustKey = DbCustKey(value.CustomerID); string chalKey = DbChalKey(value.ChallengeID); targetCust.PartitionKey = targetCustKey; targetCust.RowKey=chalKey; chal.PartitionKey = chalKey; chal.RowKey = targetCustKey; context.AttachTo(TableName, chal, null); context.UpdateObject(chal); context.AttachTo(TableName, targetCust, null); context.UpdateObject(targetCust); context.SaveChangesWithRetries(); context.Detach(targetCust); context.Detach(chal); }