Browse Source

FIX Correction Edmx suite migration

olivier.massot 7 years ago
parent
commit
00bfc06e67

+ 0 - 2
CD67.FicheCollege.Entity/App.config

@@ -26,8 +26,6 @@
   <connectionStrings>
     <!-- Copie locale de la chaine de connexion pour l'éditeur graphique de modèle -->
     <add name="EducfEntities" providerName="Npgsql" connectionString="Server=POSTGIS-01;User Id=usereducfro;Password=usereducfR0;Port=5432;Database=educf;" />
-    <add name="EducfEntities" connectionString="metadata=res://*/EntityModel.csdl|res://*/EntityModel.ssdl|res://*/EntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=T-MSSQL-02\SQLSTD2K14;initial catalog=FicheCollege;persist security info=True;user id=FicheCollege_admin;password=bk9JFwqSwYw7mEPiOhnu;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
-    <add name="educfEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Npgsql;provider connection string=&quot;Host=POSTGIS-01;Username=usereducfro;Password=usereducfR0;Port=5432;Database=educf&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />

+ 34 - 17
CD67.FicheCollege.Entity/EducfModel.edmx

@@ -107,6 +107,8 @@
           <Property Name="typerue" Type="varchar" MaxLength="100" />
           <Property Name="rivoli" Type="varchar" MaxLength="10" />
         </EntityType>
+        <!--Erreurs détectées durant la génération :
+avertissement 6002: La table/vue 'educf.educf.typeetablissement' n'a pas de clé primaire définie. La clé a été déduite et la définition a été créée en tant que table/vue en lecture seule.-->
         <Association Name="FK_EtabEffectifAnnee">
           <End Role="etablissement" Type="Self.etablissement" Multiplicity="0..1">
             <OnDelete Action="Cascade" />
@@ -181,21 +183,20 @@
         <EntityType Name="etabeffectifannee">
           <Key>
             <PropertyRef Name="id" />
-            <PropertyRef Name="idniveau" />
           </Key>
+          <Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
           <Property Name="idetablissement" Type="Int32" />
           <Property Name="annee" Type="Double" />
           <Property Name="effectif" Type="Double" />
-          <Property Name="idniveau" Type="Double" Nullable="false" />
+          <Property Name="idniveau" Type="Int32" />
           <Property Name="tap" Type="Double" />
           <Property Name="tevit" Type="Double" />
-          <Property Name="id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="nbclasses" Type="Decimal" Precision="5" Scale="0" />
           <Property Name="effectifdp" Type="Double" />
           <Property Name="effectifderog" Type="Double" />
           <Property Name="tapsec" Type="Double" />
           <NavigationProperty Name="etablissement" Relationship="Self.FK_EtabEffectifAnnee" FromRole="etabeffectifannee" ToRole="etablissement" />
-          <NavigationProperty Name="niveau" Relationship="educfModel.etabeffectifanneeniveau" FromRole="etabeffectifannee" ToRole="niveau" />
+          <NavigationProperty Name="niveau" Relationship="educfModel.niveauetabeffectifannee" FromRole="etabeffectifannee" ToRole="niveau" />
         </EntityType>
         <EntityType Name="etablissement">
           <Key>
@@ -207,7 +208,7 @@
           <Property Name="idtype" Type="Double" />
           <Property Name="privepublic" Type="Double" />
           <Property Name="numadresse" Type="String" MaxLength="20" FixedLength="false" Unicode="true" />
-          <Property Name="idrue" Type="Double" />
+          <Property Name="idrue" Type="Int32" />
           <Property Name="adresse2" Type="String" MaxLength="250" FixedLength="false" Unicode="true" />
           <Property Name="tel" Type="String" MaxLength="20" FixedLength="false" Unicode="true" />
           <Property Name="fax" Type="String" MaxLength="20" FixedLength="false" Unicode="true" />
@@ -239,7 +240,7 @@
           <Property Name="libellecarte1" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
           <Property Name="libellecarte2" Type="String" MaxLength="200" FixedLength="false" Unicode="true" />
           <NavigationProperty Name="etabeffectifannees" Relationship="Self.FK_EtabEffectifAnnee" FromRole="etablissement" ToRole="etabeffectifannee" />
-          <NavigationProperty Name="rue" Relationship="educfModel.rueetablissement" FromRole="etablissement" ToRole="rue" />
+          <NavigationProperty Name="rue" Relationship="educfModel.etablissementrue" FromRole="etablissement" ToRole="rue" />
         </EntityType>
         <EntityType Name="niveau">
           <Key>
@@ -252,7 +253,7 @@
           <Property Name="idniveaumontee" Type="Decimal" Precision="5" Scale="0" />
           <Property Name="capacite" Type="Decimal" Precision="3" Scale="0" />
           <Property Name="capacitezep" Type="Decimal" Precision="3" Scale="0" />
-          <NavigationProperty Name="etabeffectifannees" Relationship="educfModel.etabeffectifanneeniveau" FromRole="niveau" ToRole="etabeffectifannee" />
+          <NavigationProperty Name="etabeffectifannees" Relationship="educfModel.niveauetabeffectifannee" FromRole="niveau" ToRole="etabeffectifannee" />
         </EntityType>
         <EntityType Name="rue">
           <Key>
@@ -264,7 +265,7 @@
           <Property Name="typerue" Type="String" MaxLength="100" FixedLength="false" Unicode="true" />
           <Property Name="rivoli" Type="String" MaxLength="10" FixedLength="false" Unicode="true" />
           <NavigationProperty Name="commune" Relationship="Self.FK_RuesCommunes" FromRole="rues" ToRole="commune" />
-          <NavigationProperty Name="etablissement" Relationship="educfModel.rueetablissement" FromRole="rue" ToRole="etablissement" />
+          <NavigationProperty Name="etablissements" Relationship="educfModel.etablissementrue" FromRole="rue" ToRole="etablissement" />
         </EntityType>
         <Association Name="FK_RuesCommunes">
           <End Role="commune" Type="Self.commune" Multiplicity="0..1">
@@ -308,22 +309,38 @@
             <End Role="etablissement" EntitySet="etablissements" />
             <End Role="etabeffectifannee" EntitySet="etabeffectifannees" />
           </AssociationSet>
-          <AssociationSet Name="rueetablissement" Association="educfModel.rueetablissement">
-            <End Role="rue" EntitySet="rues" />
+          <AssociationSet Name="etablissementrue" Association="educfModel.etablissementrue">
             <End Role="etablissement" EntitySet="etablissements" />
+            <End Role="rue" EntitySet="rues" />
           </AssociationSet>
-          <AssociationSet Name="etabeffectifanneeniveau" Association="educfModel.etabeffectifanneeniveau">
-            <End Role="etabeffectifannee" EntitySet="etabeffectifannees" />
+          <AssociationSet Name="niveauetabeffectifannee" Association="educfModel.niveauetabeffectifannee">
             <End Role="niveau" EntitySet="niveaux" />
+            <End Role="etabeffectifannee" EntitySet="etabeffectifannees" />
           </AssociationSet>
         </EntityContainer>
-        <Association Name="rueetablissement">
-          <End Type="educfModel.rue" Role="rue" Multiplicity="0..1" />
+        <Association Name="etablissementrue">
           <End Type="educfModel.etablissement" Role="etablissement" Multiplicity="*" />
+          <End Type="educfModel.rue" Role="rue" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="rue">
+              <PropertyRef Name="id" />
+            </Principal>
+            <Dependent Role="etablissement">
+              <PropertyRef Name="idrue" />
+            </Dependent>
+          </ReferentialConstraint>
         </Association>
-        <Association Name="etabeffectifanneeniveau">
+        <Association Name="niveauetabeffectifannee">
+          <End Type="educfModel.niveau" Role="niveau" Multiplicity="0..1" />
           <End Type="educfModel.etabeffectifannee" Role="etabeffectifannee" Multiplicity="*" />
-          <End Type="educfModel.niveau" Role="niveau" Multiplicity="1" />
+          <ReferentialConstraint>
+            <Principal Role="niveau">
+              <PropertyRef Name="id" />
+            </Principal>
+            <Dependent Role="etabeffectifannee">
+              <PropertyRef Name="idniveau" />
+            </Dependent>
+          </ReferentialConstraint>
         </Association>
       </Schema>
     </edmx:ConceptualModels>
@@ -451,7 +468,7 @@
     </Connection>
     <Options>
       <DesignerInfoPropertySet>
-        <DesignerProperty Name="ValidateOnBuild" Value="False" />
+        <DesignerProperty Name="ValidateOnBuild" Value="true" />
         <DesignerProperty Name="EnablePluralization" Value="true" />
         <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
         <DesignerProperty Name="UseLegacyProvider" Value="false" />

+ 8 - 8
CD67.FicheCollege.Entity/EducfModel.edmx.diagram

@@ -4,16 +4,16 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="1667da5ad8ca4f3eba497edb1f942fff" Name="Diagram1">
-        <EntityTypeShape EntityType="educfModel.commune" Width="1.5" PointX="0.75" PointY="1" IsExpanded="true" />
-        <EntityTypeShape EntityType="educfModel.etabeffectifannee" Width="1.5" PointX="8" PointY="3.75" IsExpanded="true" />
-        <EntityTypeShape EntityType="educfModel.etablissement" Width="1.5" PointX="5.75" PointY="1.25" IsExpanded="true" />
-        <EntityTypeShape EntityType="educfModel.niveau" Width="1.5" PointX="10.375" PointY="3.875" IsExpanded="true" />
-        <EntityTypeShape EntityType="educfModel.rue" Width="1.5" PointX="3" PointY="2.25" IsExpanded="true" />
+      <Diagram DiagramId="4c45d57d67ec45f7969f7d774047eed5" Name="Diagram1">
+        <EntityTypeShape EntityType="educfModel.commune" Width="1.5" PointX="0.875" PointY="2.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="educfModel.etabeffectifannee" Width="1.5" PointX="8.75" PointY="2.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="educfModel.etablissement" Width="2" PointX="5.75" PointY="1.25" IsExpanded="true" />
+        <EntityTypeShape EntityType="educfModel.niveau" Width="2" PointX="11.125" PointY="3" IsExpanded="true" />
+        <EntityTypeShape EntityType="educfModel.rue" Width="1.5" PointX="3.25" PointY="3.25" IsExpanded="true" />
         <AssociationConnector Association="educfModel.FK_RuesCommunes" ManuallyRouted="false" />
         <AssociationConnector Association="educfModel.FK_EtabEffectifAnnee" ManuallyRouted="false" />
-        <AssociationConnector Association="educfModel.rueetablissement" />
-        <AssociationConnector Association="educfModel.etabeffectifanneeniveau" />
+        <AssociationConnector Association="educfModel.etablissementrue" />
+        <AssociationConnector Association="educfModel.niveauetabeffectifannee" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 2 - 2
CD67.FicheCollege.Entity/etabeffectifannee.cs

@@ -14,13 +14,13 @@ namespace CD67.FicheCollege.Entity
     
     public partial class etabeffectifannee
     {
+        public int id { get; set; }
         public Nullable<int> idetablissement { get; set; }
         public Nullable<double> annee { get; set; }
         public Nullable<double> effectif { get; set; }
-        public double idniveau { get; set; }
+        public Nullable<int> idniveau { get; set; }
         public Nullable<double> tap { get; set; }
         public Nullable<double> tevit { get; set; }
-        public int id { get; set; }
         public Nullable<decimal> nbclasses { get; set; }
         public Nullable<double> effectifdp { get; set; }
         public Nullable<double> effectifderog { get; set; }

+ 1 - 1
CD67.FicheCollege.Entity/etablissement.cs

@@ -26,7 +26,7 @@ namespace CD67.FicheCollege.Entity
         public Nullable<double> idtype { get; set; }
         public Nullable<double> privepublic { get; set; }
         public string numadresse { get; set; }
-        public Nullable<double> idrue { get; set; }
+        public Nullable<int> idrue { get; set; }
         public string adresse2 { get; set; }
         public string tel { get; set; }
         public string fax { get; set; }

+ 2 - 2
CD67.FicheCollege.Entity/rue.cs

@@ -17,7 +17,7 @@ namespace CD67.FicheCollege.Entity
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
         public rue()
         {
-            this.etablissement = new HashSet<etablissement>();
+            this.etablissements = new HashSet<etablissement>();
         }
     
         public int id { get; set; }
@@ -28,6 +28,6 @@ namespace CD67.FicheCollege.Entity
     
         public virtual commune commune { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public virtual ICollection<etablissement> etablissement { get; set; }
+        public virtual ICollection<etablissement> etablissements { get; set; }
     }
 }