public virtual ServiceReceiptResponse ForeignKeyAdd(ForeignKeyAddCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } try { return(_commandBus.Publish <ForeignKeyAddCommand, ServiceReceiptResponse>(command)); } catch (Exception ex) { throw _foodWasteFaultExceptionBuilder.Build(ex, SoapNamespaces.FoodWasteSystemDataServiceName, MethodBase.GetCurrentMethod()); } }
/// <summary> /// Executes functionality which adds a foreign key to a domain object. /// </summary> /// <param name="foreignKey">Foreign key to add.</param> /// <returns>Identifier for the added foreign key.</returns> public virtual Guid ForeignKeyAdd(IForeignKey foreignKey) { if (foreignKey == null) { throw new ArgumentNullException("foreignKey"); } var command = new ForeignKeyAddCommand { DataProviderIdentifier = foreignKey.DataProvider.Identifier.HasValue ? foreignKey.DataProvider.Identifier.Value : default(Guid), ForeignKeyForIdentifier = foreignKey.ForeignKeyForIdentifier, ForeignKeyValue = foreignKey.ForeignKeyValue }; var serviceReceipt = Execute <ForeignKeyAddCommand, ServiceReceiptResponse>(command); return(serviceReceipt.Identifier.HasValue ? serviceReceipt.Identifier.Value : default(Guid)); }