Skip to content

Commit

Permalink
Added ObjectIsSavedContrains that ensures that an object has been per…
Browse files Browse the repository at this point in the history
…sisted to the database. Closes #79.
  • Loading branch information
hisystems committed Apr 12, 2013
1 parent d27d943 commit 2c915e7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Contraints/ObjectIsSavedConstraint.cs
@@ -0,0 +1,26 @@
// ___________________________________________________
//
// © Hi-Integrity Systems 2013. All rights reserved.
// www.hisystems.com.au - Toby Wicks
// ___________________________________________________
//

using System.Collections;
using System;
using System.Data;

namespace DatabaseObjects.Constraints
{
public class ObjectIsSavedConstraint : IConstraint<IDatabaseObject>
{
public bool ValueSatisfiesConstraint(IDatabaseObject value)
{
return value.IsSaved;
}

public override string ToString()
{
return "object must be saved";
}
}
}
1 change: 1 addition & 0 deletions DatabaseObjects.MonoTouch.csproj
Expand Up @@ -165,6 +165,7 @@
<Compile Include="SQL\Views\SQLDropView.cs" />
<Compile Include="SQL\Views\SQLViewExists.cs" />
<Compile Include="SQL\Expressions\SQLLogicalExpression.cs" />
<Compile Include="Contraints\ObjectIsSavedConstraint.cs" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
Expand Down
1 change: 1 addition & 0 deletions DatabaseObjects.csproj
Expand Up @@ -118,6 +118,7 @@
<Compile Include="Contraints\EmailAddressConstraint.cs" />
<Compile Include="Contraints\KeyFieldIsUniqueInCollectionConstraint.cs" />
<Compile Include="Contraints\Constraint.cs" />
<Compile Include="Contraints\ObjectIsSavedConstraint.cs" />
<Compile Include="Contraints\RegExConstraint.cs" />
<Compile Include="Contraints\DateIsTodayOrFutureForNewObjectConstraint.cs" />
<Compile Include="Contraints\NumberIsMaximumOrLesserConstraint.cs" />
Expand Down

0 comments on commit 2c915e7

Please sign in to comment.