TPC继承和并发令牌 [英] TPC Inheritance and Concurrency Tokens

查看:42
本文介绍了TPC继承和并发令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Table-Per-Concrete Type继承并定义了两个实体,如下所示:


< EntityType Name =" Base"抽象= QUOT;真"> 
< Key>< PropertyRef Name =" Id" />< / Key与GT;
< Property Type =" Guid"名称= QUOT;标识"可空= QUOT假QUOT; />
< Property Type =" Binary"名称= QUOT;版本"可空= QUOT假QUOT;的MaxLength = QUOT; 8英寸定长= QUOT;真" ConcurrencyMode = QUOT;固定"注释:StoreGeneratedPattern = QUOT;已计算" />
< / EntityType>

< EntityType Name =" Derived"碱基类型= QUOT; TestInheritance.Base" >
< / EntityType>


该实体的MSL为:

< EntitySetMapping Name =" Deriveds"> 
< EntityTypeMapping TypeName =" TestInheritance.Derived">
< MappingFragment StoreEntitySet =" Derived">
< ScalarProperty Name =" Id"的ColumnName = QUOT;标识" />
< ScalarProperty Name =" Version"的ColumnName = QUOT;版本" />
< / MappingFragment>
< / EntityTypeMapping>
< / EntitySetMapping>


所以我试图在父实体中有一个rowversion列(将由我的所有实体继承)实体)但由于我使用的是TPC,实际上并没有基本实体的表。   rowversion(和Id)列将出现在Derived表中。


问题是此模型给出了编译错误: '错误3008:从映射片段开始的问题第94行:无法在EntitySet Deriveds的派生类Base中定义新的并发令牌成员版本。'。


我不明白这个错误,可以做些什么?


 


 

解决方案

我无法重现基于以下描述的错误。你可以在这里发布你的edmx或者发送到microsoft dot com的srimand,我会看看它。


谢谢


Srikanth


I am using Table-Per-Concrete Type inheritance and have defined two entities as follows:

    <EntityType Name="Base" Abstract="true">
     <Key><PropertyRef Name="Id" /></Key>
     <Property Type="Guid" Name="Id" Nullable="false" />
     <Property Type="Binary" Name="Version" Nullable="false" MaxLength="8" FixedLength="true" ConcurrencyMode="Fixed" annotation:StoreGeneratedPattern="Computed" />
    </EntityType>

    <EntityType Name="Derived" BaseType="TestInheritance.Base" >
    </EntityType>

The MSL for the entity is:

  <EntitySetMapping Name="Deriveds">
   <EntityTypeMapping TypeName="TestInheritance.Derived">
    <MappingFragment StoreEntitySet="Derived">
     <ScalarProperty Name="Id" ColumnName="Id"/>
     <ScalarProperty Name="Version" ColumnName="Version"/>
    </MappingFragment>
   </EntityTypeMapping>
  </EntitySetMapping>

So I am trying to have a rowversion column in the parent entity (which will be inherited by all my entities) but since I am using TPC, there won't actually be a table for the base entity.  The rowversion (and Id) column will appear in the Derived table.

The problem is that this model gives a compilation error:  'Error 3008: Problem in mapping fragments starting at line 94:Cannot define new concurrency token member Version in the derived class Base of EntitySet Deriveds.'.

I don't understand this error and what can be done?

 

 

解决方案

I could not reproduce the error based on the description below. Can you post your edmx here or send it to srimand at microsoft dot com and I will take a look at it.

Thanks

Srikanth


这篇关于TPC继承和并发令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆