Mysql EF5 storegeneratedpattern identity не работает
Привет,
Я много читал по этому вопросу, но, похоже, ничего не работает.
До сих пор я убедился, что идентификатор StoreGeneratedPattern находится на двух столах. Я проверил модель и магазин. Оба имеют набор свойств. Однако, когда я вставляю в эти таблицы, оба идентификатора равны "0".
Я надеюсь, что кто-то, знакомый с этими проблемами, может взглянуть и сказать мне, где я ошибся
Спасибо
Что я уже пробовал:
Вот сгенерированный xml (нерелевантные таблицы удалены):
<?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx"> <!-- EF Runtime content --> <edmx:Runtime> <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="rule_testModel.Store" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.7" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl"> <Key> <PropertyRef Name="RateId" /> <PropertyRef Name="RateTypeId" /> <PropertyRef Name="PaymentPlanId" /> <PropertyRef Name="TariffDescriptionId" /> <PropertyRef Name="FeatureId" /> <PropertyRef Name="FuelId" /> <PropertyRef Name="Live" /> </Key> <Property Name="RateId" Type="uint" Nullable="false" /> <Property Name="Profile" Type="uint" /> <Property Name="REC" Type="varchar" MaxLength="10" /> <Property Name="PlanName" Type="varchar" MaxLength="300" /> <Property Name="RateTypeId" Type="uint" Nullable="false" /> <Property Name="PaymentPlanId" Type="uint" Nullable="false" /> <Property Name="Product" Type="varchar" MaxLength="45" /> <Property Name="ContractDuration" Type="varchar" MaxLength="45" /> <Property Name="TariffDescriptionId" Type="uint" Nullable="false" /> <Property Name="TariffUnrestricted" Type="decimal" Precision="6" Scale="3" /> <Property Name="TariffDay" Type="decimal" Precision="6" Scale="3" /> <Property Name="TariffNight" Type="decimal" Precision="6" Scale="3" /> <Property Name="TariffEveningWeekend" Type="decimal" Precision="6" Scale="3" /> <Property Name="StandingChargePenceDay" Type="decimal" Precision="6" Scale="3" /> <Property Name="StandingChargeGBPQuarter" Type="decimal" Precision="6" Scale="3" /> <Property Name="StandingChargeGBPMonth" Type="decimal" Precision="6" Scale="3" /> <Property Name="StandingChargeGBPYear" Type="decimal" Precision="6" Scale="3" /> <Property Name="CapacityCharge" Type="decimal" Precision="7" Scale="3" /> <Property Name="FeatureId" Type="uint" Nullable="false" /> <Property Name="FromCon" Type="uint" /> <Property Name="ToCon" Type="uint" /> <Property Name="Version" Type="varchar" MaxLength="45" /> <Property Name="PriceType" Type="varchar" MaxLength="45" /> <Property Name="Duration" Type="uint" /> <Property Name="SupplierId" Type="uint" /> <Property Name="FuelId" Type="uint" Nullable="false" /> <Property Name="ProposedStartDate" Type="date" /> <Property Name="SignWindow" Type="uint" /> <Property Name="DateAdded" Type="datetime" Precision="0" StoreGeneratedPattern="Identity" /> <Property Name="Live" Type="uint" Nullable="false" /> <Property Name="MaxRate" Type="decimal" Precision="6" Scale="3" /> <Property Name="MaxSc" Type="decimal" Precision="6" Scale="3" /> <Property Name="UpStep" Type="decimal" Precision="6" Scale="3" /> </EntityType> <EntityType Name="conditions"> <Key> <PropertyRef Name="ConditionId" /> </Key> <Property Name="ConditionId" Type="uint" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="ProductId" Type="uint" Nullable="false" /> <Property Name="Profile" Type="usmallint" /> <Property Name="REC" Type="varchar" MaxLength="10" /> <Property Name="RateTypeId" Type="uint" /> <Property Name="PaymentPlanId" Type="uint" /> <Property Name="FeatureId" Type="uint" /> <Property Name="FromCon" Type="uint" /> <Property Name="ToCon" Type="uint" /> <Property Name="Duration" Type="uint" /> <Property Name="SupplierId" Type="uint" /> <Property Name="FuelId" Type="uint" /> <Property Name="live" Type="bool" /> <Property Name="TempRateId" Type="uint" /> </EntityType> <EntityType Name="products"> <Key> <PropertyRef Name="ProductId" /> </Key> <Property Name="ProductId" Type="uint" Nullable="false" StoreGeneratedPattern="Identity" /> <Property Name="RateId" Type="uint" /> <Property Name="FromProductId" Type="uint" /> <Property Name="ServiceRef" Type="uint" /> <Property Name="UpCom" Type="decimal" Precision="6" Scale="3" /> <Property Name="UpSC" Type="decimal" Precision="6" Scale="3" /> <Property Name="FixedCom" Type="decimal" Precision="8" Scale="3" /> <Property Name="Live" Type="bool" Nullable="false" /> <Property Name="BrokerId" Type="uint" /> <Property Name="MaxRate" Type="decimal" Precision="6" Scale="3" /> <Property Name="MaxSC" Type="decimal" Precision="6" Scale="3" /> <Property Name="Step" Type="decimal" Precision="6" Scale="3" /> <Property Name="Fits" Type="decimal" Precision="6" Scale="3" /> <Property Name="Disc" Type="decimal" Precision="6" Scale="3" /> <Property Name="UpliftTypeId" Type="uint" Nullable="false" /> <Property Name="SupplierId" Type="uint" Nullable="false" /> <Property Name="FromCon" Type="uint" /> <Property Name="ToCon" Type="uint" /> </EntityType> <Key> <PropertyRef Name="word_id" /> </Key> <Property Name="word_id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" /> <Property Name="word_context" Type="varchar" MaxLength="45" Nullable="false" /> <Property Name="word_word" Type="varchar" MaxLength="255" Nullable="false" /> </EntityType> <EntityContainer Name="rule_testModelStoreContainer"> <EntitySet Name="conditions" EntityType="Self.conditions" Schema="rule_test" store:Type="Tables" /> <EntitySet Name="products" EntityType="Self.products" Schema="rule_test" store:Type="Tables" /> </EntityContainer> </Schema></edmx:StorageModels> <!-- CSDL content --> <edmx:ConceptualModels> <Schema Namespace="rule_testModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"> <EntityContainer Name="eBroker2Entities" annotation:LazyLoadingEnabled="true"> <EntitySet Name="products" EntityType="rule_testModel.product" /> <EntitySet Name="conditions" EntityType="rule_testModel.condition" /> </EntityContainer> <EntityType Name="product"> <Key> <PropertyRef Name="ProductId" /> </Key> <Property Name="ProductId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" /> <Property Name="RateId" Type="Int32" /> <Property Name="FromProductId" Type="Int32" /> <Property Name="ServiceRef" Type="Int32" /> <Property Name="UpCom" Type="Decimal" /> <Property Name="UpSC" Type="Decimal" /> <Property Name="FixedCom" Type="Decimal" /> <Property Name="Live" Type="Boolean" Nullable="false" /> <Property Name="BrokerId" Type="Int32" /> <Property Name="MaxRate" Type="Decimal" /> <Property Name="MaxSC" Type="Decimal" /> <Property Name="Step" Type="Decimal" /> <Property Name="Fits" Type="Decimal" /> <Property Name="Disc" Type="Decimal" /> <Property Name="UpliftTypeId" Type="Int32" Nullable="false" /> <Property Name="SupplierId" Type="Int32" Nullable="false" /> <Property Name="FromCon" Type="Int32" /> <Property Name="ToCon" Type="Int32" /> </EntityType> <EntityType Name="condition"> <Key> <PropertyRef Name="ConditionId" /> </Key> <Property Name="ConditionId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" /> <Property Name="ProductId" Type="Int32" Nullable="false" /> <Property Name="Profile" Type="Int32" /> <Property Name="REC" Type="String" MaxLength="10" FixedLength="false" Unicode="false" /> <Property Name="RateTypeId" Type="Int32" /> <Property Name="PaymentPlanId" Type="Int32" /> <Property Name="FeatureId" Type="Int32" /> <Property Name="FromCon" Type="Int32" /> <Property Name="ToCon" Type="Int32" /> <Property Name="Duration" Type="Int32" /> <Property Name="SupplierId" Type="Int32" /> <Property Name="FuelId" Type="Int32" /> <Property Name="live" Type="Boolean" /> <Property Name="TempRateId" Type="Int32" /> </EntityType> </Schema> </edmx:ConceptualModels> <!-- C-S mapping content --> <edmx:Mappings> <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs"> <EntityContainerMapping StorageEntityContainer="rule_testModelStoreContainer" CdmEntityContainer="eBroker2Entities"> <EntitySetMapping Name="products"> <EntityTypeMapping TypeName="rule_testModel.product"> <MappingFragment StoreEntitySet="products"> <ScalarProperty Name="ToCon" ColumnName="ToCon" /> <ScalarProperty Name="FromCon" ColumnName="FromCon" /> <ScalarProperty Name="SupplierId" ColumnName="SupplierId" /> <ScalarProperty Name="UpliftTypeId" ColumnName="UpliftTypeId" /> <ScalarProperty Name="Disc" ColumnName="Disc" /> <ScalarProperty Name="Fits" ColumnName="Fits" /> <ScalarProperty Name="Step" ColumnName="Step" /> <ScalarProperty Name="MaxSC" ColumnName="MaxSC" /> <ScalarProperty Name="MaxRate" ColumnName="MaxRate" /> <ScalarProperty Name="BrokerId" ColumnName="BrokerId" /> <ScalarProperty Name="Live" ColumnName="Live" /> <ScalarProperty Name="FixedCom" ColumnName="FixedCom" /> <ScalarProperty Name="UpSC" ColumnName="UpSC" /> <ScalarProperty Name="UpCom" ColumnName="UpCom" /> <ScalarProperty Name="ServiceRef" ColumnName="ServiceRef" /> <ScalarProperty Name="FromProductId" ColumnName="FromProductId" /> <ScalarProperty Name="RateId" ColumnName="RateId" /> <ScalarProperty Name="ProductId" ColumnName="ProductId" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> <EntitySetMapping Name="conditions"> <EntityTypeMapping TypeName="rule_testModel.condition"> <MappingFragment StoreEntitySet="conditions"> <ScalarProperty Name="TempRateId" ColumnName="TempRateId" /> <ScalarProperty Name="live" ColumnName="live" /> <ScalarProperty Name="FuelId" ColumnName="FuelId" /> <ScalarProperty Name="SupplierId" ColumnName="SupplierId" /> <ScalarProperty Name="Duration" ColumnName="Duration" /> <ScalarProperty Name="ToCon" ColumnName="ToCon" /> <ScalarProperty Name="FromCon" ColumnName="FromCon" /> <ScalarProperty Name="FeatureId" ColumnName="FeatureId" /> <ScalarProperty Name="PaymentPlanId" ColumnName="PaymentPlanId" /> <ScalarProperty Name="RateTypeId" ColumnName="RateTypeId" /> <ScalarProperty Name="REC" ColumnName="REC" /> <ScalarProperty Name="Profile" ColumnName="Profile" /> <ScalarProperty Name="ProductId" ColumnName="ProductId" /> <ScalarProperty Name="ConditionId" ColumnName="ConditionId" /> </MappingFragment> </EntityTypeMapping> </EntitySetMapping> </EntityContainerMapping> </Mapping> </edmx:Mappings> </edmx:Runtime> <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) --> <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx"> <Connection> <DesignerInfoPropertySet> <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /> </DesignerInfoPropertySet> </Connection> <Options> <DesignerInfoPropertySet> <DesignerProperty Name="ValidateOnBuild" Value="true" /> <DesignerProperty Name="EnablePluralization" Value="true" /> <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" /> <DesignerProperty Name="UseLegacyProvider" Value="true" /> <DesignerProperty Name="CodeGenerationStrategy" Value="None" /> </DesignerInfoPropertySet> </Options> <!-- Diagram content (shape and connector positions) --> <Diagrams></Diagrams> </Designer> </edmx:Edmx></Mapping> </edmx:Mappings> </edmx:Runtime> <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) --> <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx"> <Connection> <DesignerInfoPropertySet> <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /> </DesignerInfoPropertySet> </Connection> <Options> <DesignerInfoPropertySet> <DesignerProperty Name="ValidateOnBuild" Value="true" /> <DesignerProperty Name="EnablePluralization" Value="true" /> <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" /> <DesignerProperty Name="UseLegacyProvider" Value="true" /> <DesignerProperty Name="CodeGenerationStrategy" Value="None" /> </DesignerInfoPropertySet> </Options> <!-- Diagram content (shape and connector positions) --> <Diagrams></Diagrams> </Designer> </edmx:Edmx>