public override bool Equals(object obj) { var otherId = obj as SalesOrderDetailId; if (otherId == null) { return(false); } return(SalesOrder.Equals(otherId.SalesOrder) && SalesOrderDetailID.Equals(otherId.SalesOrderDetailID)); }