File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
FluentNHibernate.Testing/FluentInterfaceTests Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -33,5 +33,18 @@ public void CanSetFormula()
33
33
ElementMapping elementMapping = ( ( IElementMappingProvider ) part ) . GetElementMapping ( ) ;
34
34
elementMapping . Formula . ShouldEqual ( "formula" ) ;
35
35
}
36
+
37
+ [ Test ]
38
+ public void CanDeclareColumnNullable ( )
39
+ {
40
+ var part = new ElementPart ( typeof ( MappedObject ) ) ;
41
+ part . Column ( "nullabilityCheck" ) ;
42
+ part . Nullable ( ) ;
43
+
44
+ ElementMapping elementMapping = ( ( IElementMappingProvider ) part ) . GetElementMapping ( ) ;
45
+ var columnMappings = elementMapping . Columns . ToList ( ) ;
46
+ columnMappings . First ( ) . Nullable . ShouldEqual ( true ) ;
47
+
48
+ }
36
49
}
37
50
}
Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ public ElementPart Formula(string formula)
66
66
return this ;
67
67
}
68
68
69
+ /// <summary>
70
+ /// Specify the nullability of the column
71
+ /// </summary>
72
+ public ElementPart Nullable ( )
73
+ {
74
+ columnAttributes . Set ( "NotNull" , Layer . UserSupplied , false ) ;
75
+ return this ;
76
+ }
77
+
69
78
ElementMapping IElementMappingProvider . GetElementMapping ( )
70
79
{
71
80
var mapping = new ElementMapping ( attributes . Clone ( ) ) ;
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ public bool NotNull
47
47
get { return attributes . GetOrDefault < bool > ( "NotNull" ) ; }
48
48
}
49
49
50
+ public bool Nullable
51
+ {
52
+ get { return ! NotNull ; }
53
+ }
54
+
50
55
public bool Unique
51
56
{
52
57
get { return attributes . GetOrDefault < bool > ( "Unique" ) ; }
You can’t perform that action at this time.
0 commit comments