public static IOrderCommand ToCreateOrMergePatchOrder <TCreateOrder, TMergePatchOrder, TCreateOrderRole, TMergePatchOrderRole, TCreateOrderItem, TMergePatchOrderItem, TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>(this IOrderState state) where TCreateOrder : ICreateOrder, new() where TMergePatchOrder : IMergePatchOrder, new() where TCreateOrderRole : ICreateOrderRole, new() where TMergePatchOrderRole : IMergePatchOrderRole, new() where TCreateOrderItem : ICreateOrderItem, new() where TMergePatchOrderItem : IMergePatchOrderItem, new() where TCreateOrderShipGroup : ICreateOrderShipGroup, new() where TMergePatchOrderShipGroup : IMergePatchOrderShipGroup, new() where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new() where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new() { bool bUnsaved = ((IOrderState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateOrder <TCreateOrder, TCreateOrderRole, TCreateOrderItem, TCreateOrderShipGroup, TCreateOrderItemShipGroupAssociation>()); } else { return(state.ToMergePatchOrder <TMergePatchOrder, TCreateOrderRole, TMergePatchOrderRole, TCreateOrderItem, TMergePatchOrderItem, TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>()); } }