Skip to content

Commit

Permalink
Delete contact phone numbers when deleting a contact.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan Young committed Jan 11, 2014
1 parent 696fa20 commit 6679721
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 49 deletions.
10 changes: 9 additions & 1 deletion Source/Core/Persistence/Contacts/Contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,22 @@
</select>

<delete id="DeleteContactByIdentifier" parameterClass="guid">
<![CDATA[
DELETE ContactEmailAddresses
FROM ContactEmailAddresses cea
INNER JOIN Contacts c
ON cea.ContactId = c.ContactId
WHERE c.ContactIdentifier = #value#

DELETE ContactPhoneNumbers
FROM ContactPhoneNumbers cp
INNER JOIN Contacts c
ON cp.ContactId = c.ContactId
WHERE c.ContactIdentifier = #value#
DELETE FROM Contacts
WHERE ContactIdentifier = #value#
]]>
</delete>

<!-- Contact Email Addresses-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: Contact Service Can Perform CRUD Operations
Feature: Contact Service Can Perform CRUD Operations For Contacts
In order to remember my contacts
As a user
I want to be able to save and retrieve a contact
Expand All @@ -20,6 +20,7 @@ Scenario: Insert Update and Select
Scenario: Insert and Delete
Given I create a contact
And I set email address user@home.com on the contact
And I set phone number (111) 111-1111 on the contact
And I save the contact
And I delete the contact
When I retrieve the contact
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Source/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
<DesignTime>True</DesignTime>
<DependentUpon>ContactServiceCanManageMultiplePhoneNumbersForAContact.feature</DependentUpon>
</Compile>
<Compile Include="AcceptanceTests\ContactService\ContactServiceCanPerformCRUDOperations.feature.cs">
<Compile Include="AcceptanceTests\ContactService\ContactServiceCanPerformCRUDOperationsForContacts.feature.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>ContactServiceCanPerformCRUDOperations.feature</DependentUpon>
<DependentUpon>ContactServiceCanPerformCRUDOperationsForContacts.feature</DependentUpon>
</Compile>
<Compile Include="AcceptanceTests\ContactService\ContactServiceSteps.cs" />
<Compile Include="AcceptanceTests\StepArgumentTransformations.cs" />
Expand All @@ -90,9 +90,9 @@
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>ContactServiceCanManageMultiplePhoneNumbersForAContact.feature.cs</LastGenOutput>
</None>
<None Include="AcceptanceTests\ContactService\ContactServiceCanPerformCRUDOperations.feature">
<None Include="AcceptanceTests\ContactService\ContactServiceCanPerformCRUDOperationsForContacts.feature">
<Generator>SpecFlowSingleFileGenerator</Generator>
<LastGenOutput>ContactServiceCanPerformCRUDOperations.feature.cs</LastGenOutput>
<LastGenOutput>ContactServiceCanPerformCRUDOperationsForContacts.feature.cs</LastGenOutput>
</None>
<None Include="App.config">
<SubType>Designer</SubType>
Expand Down

0 comments on commit 6679721

Please sign in to comment.