Entity framework 分析BreezeJS客户端中的元数据时发生异常
前传和版本信息: BreezeJS客户端版本:1.5.2 通过设计时EntityFramework模型(6.1.2)在自定义服务器上生成的元数据 BreezeLabs EdmBuilder(1.0.5) 生成元数据时出现问题,可在此处阅读:Entity framework 分析BreezeJS客户端中的元数据时发生异常,entity-framework,enums,metadata,breeze,Entity Framework,Enums,Metadata,Breeze,前传和版本信息: BreezeJS客户端版本:1.5.2 通过设计时EntityFramework模型(6.1.2)在自定义服务器上生成的元数据 BreezeLabs EdmBuilder(1.0.5) 生成元数据时出现问题,可在此处阅读: 问题/问题: 现在,breeze客户端在解释元数据时抛出错误 Unable to process returned metadata: A nonnullable DataProperty cannot have a null defaultValue.
问题/问题: 现在,breeze客户端在解释元数据时抛出错误
Unable to process returned metadata: A nonnullable DataProperty cannot have a null defaultValue. Name: MySuperDuperEnum
异常发生在第7110行的breeze.debug.js中-函数parseCsdlSimpleProperty(父类型、csdlProperty、keyNamesOnServer)
这里怎么了?我有错误的元数据吗
以下是元数据:
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="3.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="ODataMetaDataGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<EntityType Name="MyObject" p5:ClrType="GreatPersistencyNamespace.Model.GreatStuff.MyObject, BreezeEval, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" xmlns:p5="http://schemas.microsoft.com/ado/2013/11/edm/customannotation">
<Key>
<PropertyRef Name="ID"/>
</Key>
<Property Name="ID" Nullable="false" Type="Edm.Int32" p7:StoreGeneratedPattern="Identity" xmlns:p7="http://schemas.microsoft.com/ado/2009/02/edm/annotation"/>
<Property FixedLength="false" MaxLength="Max" Name="Name" Type="Edm.String" Unicode="true"/>
<Property Name="IsActive" Nullable="false" Type="Edm.Boolean"/>
<Property Name="IsGreat" Nullable="false" Type="Edm.Boolean"/>
<Property FixedLength="false" MaxLength="Max" Name="Description" Type="Edm.String" Unicode="true"/>
<Property Name="Address" Nullable="false" Type="ODataMetaDataGenerator.Address"/>
<Property Name="BehaviourType" Nullable="false" Type="ODataMetaDataGenerator.BehaviourType"/>
</EntityType>
<EnumType Name="BehaviourType" UnderlyingType="Edm.Byte" p5:ClrType="GreatPersistencyNamespace.Model.GreatStuff.BehaviourType, BreezeEval, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" xmlns:p5="http://schemas.microsoft.com/ado/2013/11/edm/customannotation">
<Member Name="RUDE" Value="1"/>
<Member Name="KIND" Value="2"/>
<Member Name="UNKNOWN" Value="3"/>
</EnumType>
<EntityContainer Name="TheGreatModelContainer" p5:UseClrTypes="true" xmlns:p5="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" >
<EntitySet EntityType="ODataMetaDataGenerator.MyObject" Name="MyObjects"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
这是由于第7091行-var dataType=dataType.fromdmdatatype(csdlProperty.type)中的故障造成的代码>
因为csdlProperty看起来像:
{
name: "BehaviourType",
nullable: undefined
type: "ODataMetaDataGenerator.BehaviourType"
}
这当然不是Edm类型,因此失败了。。此处是否应使用枚举的基础类型
{
name: "BehaviourType",
nullable: undefined
type: "ODataMetaDataGenerator.BehaviourType"
}