예제 #1
0
        /// <summary>
        /// Should ONLY contain the "business value signature" of the object and not the Id,
        /// which is handled by <see cref="Entity" />.  This method should return a unique
        /// int representing a unique signature of the domain object.  For
        /// example, no two different orders should have the same ShipToName, OrderDate and OrderedBy;
        /// therefore, the returned "signature" should be expressed as demonstrated below.
        ///
        /// Alternatively, we could decorate properties with the [DomainSignature] attribute, as shown in
        /// <see cref="Customer" />, but here's an example of overriding it nonetheless.
        /// </summary>
        public override bool HasSameObjectSignatureAs(BaseObject compareTo)
        {
            Order orderCompareTo = compareTo as Order;

            return(orderCompareTo != null && ShipToName.Equals(orderCompareTo.ShipToName) &&
                   (OrderDate ?? DateTime.MinValue).Equals((orderCompareTo.OrderDate ?? DateTime.MinValue)) &&
                   OrderedBy.Equals(orderCompareTo.OrderedBy));
        }
        protected override void ProcessAdditionalFields(ref Entity record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            record["salesrepid"]             = SalesRepId.Get(Context.ExecutionContext);
            record["shipto_city"]            = ShipToCity.Get(Context.ExecutionContext);
            record["shipto_country"]         = ShipToCountry.Get(Context.ExecutionContext);
            record["shipto_fax"]             = ShipToFax.Get(Context.ExecutionContext);
            record["shipto_line1"]           = ShipToLine1.Get(Context.ExecutionContext);
            record["shipto_line2"]           = ShipToLine2.Get(Context.ExecutionContext);
            record["shipto_line3"]           = ShipToLine3.Get(Context.ExecutionContext);
            record["shipto_name"]            = ShipToName.Get(Context.ExecutionContext);
            record["shipto_postalcode"]      = ShipToPostalCode.Get(Context.ExecutionContext);
            record["shipto_stateorprovince"] = ShipToStateOrProvince.Get(Context.ExecutionContext);
            record["shipto_telephone"]       = ShipToTelephone.Get(Context.ExecutionContext);
            record["willcall"] = WillCall.Get(Context.ExecutionContext);
        }