Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: [DataMember(IsRequired=true)] doesn't make property as required in ODataConventionModelBuilder [459]

$
0
0
Since we already support [Required], we should support this as well.

For example:

[DataContract]
public class Vehicle
{
[Key]
[DataMember]
public int Model { get; set; }

[Key]
[DataMember]
public string Name { get; set; }

[DataMember(IsRequired=true)]
public virtual int? WheelCount { get; set; }
}

The edm model is:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="ODataRepro" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="Vehicle">
<Key>
<PropertyRef Name="Model" />
<PropertyRef Name="Name" />
</Key>
<Property Name="Model" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" Nullable="false" />
<Property Name="WheelCount" Type="Edm.Int32" />
</EntityType>
</Schema>
<Schema Namespace="Default" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityContainer Name="Container">
<EntitySet Name="Vechicles" EntityType="ODataRepro.Vehicle" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

Viewing all articles
Browse latest Browse all 7215

Trending Articles