Reputation: 111
My model contains the following entity:
<cf:entity name="SomeEntity">
<cf:property name="Id" key="true" />
<cf:property name="SomeDate" typeName="date?" />
<cf:view name="SomeEntitySummary" autoLightweight="true" checkLevel="none">
<cf:viewProperty name="Id" />
<cf:viewProperty name="SomeDate" nullable="true" typeName="date?" />
</cf:view>
</cf:entity>
The produced code for the SomeEntity class contains a SomeDate property of type
Nullable<DateTime>
However, the produced code for the SomeEntitySummary class contains a SomeDate property of type DateTime and is not nullable.
How can I produce a nullable property in the lightweight entity that is produced for the database view?
Upvotes: 1
Views: 55
Reputation: 21347
CodeFluent Entities infer views from the properties of the entity. So, if the property is nullable, the property of the view should also be nullable. However, it seems there is a small issue, so you must declare the property as modelNullable
explicitly (the modeler generates the right xml).
The following model does generate a DateTime?
property in the SomeView
class:
<cf:entity name="Customer">
<cf:property name="Id" key="true" />
<cf:property name="Name" />
<cf:property name="SomeDate" modelNullable="true" typeName="date" />
<cf:view autoLightweight="true" name="SomeView">
<cf:viewProperty name="Id" />
<cf:viewProperty name="SomeDate" />
</cf:view>
</cf:entity>
Upvotes: 0