Using AutoQuery RDBMS Update query

I was wondering what I would get if on the update of a row using an Update dto as below

[Route("/***/{Id}", "PUT")]
[ValidateRequest("IsAuthenticated")]
[NamedConnection("***")]
[DataContract]
public partial class UpdateOnlineOrder
    : IReturn<IdResponse>, IPut, IUpdateDb<OnlineOrder>
{
    [DataMember(Order=1)]
    public virtual int Id { get; set; }

    [DataMember(Order=2)]
    public virtual DateTime OrderDate { get; set; }

    [DataMember(Order=3)]
    public virtual string ReferenceTransactionID { get; set; }

    [DataMember(Order=4)]
    public virtual string CompanyName { get; set; }

    [DataMember(Order=5)]
    public virtual string CustomerFirstName { get; set; }

    [DataMember(Order=6)]
    public virtual string CustomerLastName { get; set; }

    [DataMember(Order=7)]
    public virtual string Address1 { get; set; }

    [DataMember(Order=8)]
    public virtual string Address2 { get; set; }

    [DataMember(Order=9)]
    public virtual string City { get; set; }

    [DataMember(Order=10)]
    public virtual string State { get; set; }

    [DataMember(Order=11)]
    public virtual string PostalCode { get; set; }

    [DataMember(Order=12)]
    public virtual string Country { get; set; }

    [DataMember(Order=13)]
    public virtual string MailAddress1 { get; set; }

    [DataMember(Order=14)]
    public virtual string MailAddress2 { get; set; }

    [DataMember(Order=15)]
    public virtual string MailAddress3 { get; set; }

    [DataMember(Order=16)]
    public virtual string MailCity { get; set; }

    [DataMember(Order=17)]
    public virtual string MailState { get; set; }

    [DataMember(Order=18)]
    public virtual string MailPostalCode { get; set; }

    [DataMember(Order=19)]
    public virtual string MailCountry { get; set; }

    [DataMember(Order=20)]
    public virtual string Phone { get; set; }

    [DataMember(Order=21)]
    public virtual string EmailAddress { get; set; }

    [DataMember(Order=22)]
    public virtual decimal TotalOrderAmount { get; set; }

    [DataMember(Order=23)]
    public virtual decimal TaxAmount { get; set; }

    [DataMember(Order=24)]
    public virtual decimal ShippingAmount { get; set; }

    [DataMember(Order=25)]
    public virtual int ChannelID { get; set; }

    [DataMember(Order=26)]
    public virtual DateTime? PromiseDate { get; set; }

    [DataMember(Order=27)]
    public virtual bool? Expedited { get; set; }

    [DataMember(Order=28)]
    public virtual bool? IsPOBox { get; set; }

    [DataMember(Order=29)]
    public virtual bool? IsAPO { get; set; }

    [DataMember(Order=30)]
    public virtual int StatusId { get; set; }

    [DataMember(Order=31)]
    public virtual string GiftWrapMessage { get; set; }

    [DataMember(Order=32)]
    public virtual string GiftWrapSKU { get; set; }

    [DataMember(Order=33)]
    public virtual decimal? GiftWrapAmount { get; set; }

    [DataMember(Order=34)]
    public virtual int? ShippingServiceID { get; set; }

    [DataMember(Order=35)]
    public virtual bool DropShipment { get; set; }

    [DataMember(Order=36)]
    public virtual bool? IsPrime { get; set; }

    [DataMember(Order=37)]
    public virtual string CompanyID { get; set; }

    [DataMember(Order=38)]
    public virtual string CustomerID { get; set; }

    [DataMember(Order=39)]
    public virtual string ShipTo { get; set; }

    [DataMember(Order=40)]
    public virtual string OrderAttribute { get; set; }

    [DataMember(Order=41)]
    public virtual bool IsFreight { get; set; }

    [DataMember(Order=42)]
    public virtual bool ReorderLabels { get; set; }

    [DataMember(Order=43)]
    public virtual string ShipVia { get; set; }

    [DataMember(Order=44)]
    public virtual string ExternalOrderNumber { get; set; }

    [DataMember(Order=45)]
    public virtual string BuildError { get; set; }

    [DataMember(Order=46)]
    public virtual DateTime? CreatedAt { get; set; }

    [DataMember(Order=47)]
    public virtual bool? NoSignatureRequired { get; set; }

    [DataMember(Order=48)]
    public virtual bool TotalsUpdated { get; set; }

    [DataMember(Order=49)]
    public virtual bool? AddressValidated { get; set; }

    [DataMember(Order=50)]
    public virtual bool? IsResidence { get; set; }

    [DataMember(Order=51)]
    public virtual string AddressValidationMessages { get; set; }

    [DataMember(Order=52)]
    public virtual string RequestedShipper { get; set; }

    [DataMember(Order=53)]
    public virtual string RequestedShippingServiceCode { get; set; }

    [DataMember(Order=54)]
    public virtual bool? ReturnLabelRequested { get; set; }
}

var updateOnlineOrderResult = await OnlineOrdersClient.PutAsync(new UpdateOnlineOrder
{
    Id = UniqueOrderID.Value,
    StatusId = 5
});

if the row is deadlocked what would the result look like. Would it be an actual exception or would the ResponseStatus be a ErrorCode ? Deadlocks are hard to test for unless you can tell me how to force one :).

Who’s deadlocking the row? AutoQuery just performs a simple update, it’s not locking any rows.

If you want you can use Optimistic Concurrency to prevent updates on stale data.

We have sql jobs running against these tables doing inserts updates and queries all the time. They are main tables lots of activities. I have seen deadlocks against these tables for years. Its just that lately we are seeing “statuses” not changing when they should and I was wondering if the update was giving me a deadlock victim error that I am not handling.

I can’t see how a simple Update can cause a deadlock, but if it did it would throw the same DB Exception the ADO .NET provider throws when it detects a deadlock.

I figured it would I just don’t know if it would come back in the response as an error or if the call itself would except