Browse Source

NEW Ajout des ActionsCLAS : BDD, Entity & Factory

julien.legrand 8 years ago
parent
commit
dcc9522276

+ 7 - 0
CD67.FicheCollege.BDD/Actions-CLAS.sql

@@ -0,0 +1,7 @@
+CREATE TABLE [dbo].[Actions-CLAS]
+(
+	[College_Id] NVARCHAR(8) NOT NULL PRIMARY KEY, 
+    [Action] BIT NULL, 
+    [Commentaire] NTEXT NULL, 
+    CONSTRAINT [FK_Actions-CLAS_College] FOREIGN KEY ([College_Id]) REFERENCES [Colleges]([Id])
+)

+ 7 - 0
CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.refactorlog

@@ -77,4 +77,11 @@
     <Property Name="ParentElementType" Value="SqlTable" />
     <Property Name="NewName" Value="College_Id" />
   </Operation>
+  <Operation Name="Rename Refactor" Key="fadf50e8-62b2-46e4-b427-254e6321825b" ChangeDateTime="01/11/2018 16:43:18">
+    <Property Name="ElementName" Value="[dbo].[Actions_CLAS].[b]" />
+    <Property Name="ElementType" Value="SqlSimpleColumn" />
+    <Property Name="ParentElementName" Value="[dbo].[Actions_CLAS]" />
+    <Property Name="ParentElementType" Value="SqlTable" />
+    <Property Name="NewName" Value="Action" />
+  </Operation>
 </Operations>

+ 1 - 0
CD67.FicheCollege.BDD/CD67.FicheCollege.BDD.sqlproj

@@ -64,6 +64,7 @@
     <Build Include="Territoires.sql" />
     <Build Include="Colleges.sql" />
     <Build Include="Identites.sql" />
+    <Build Include="Actions-CLAS.sql" />
   </ItemGroup>
   <ItemGroup>
     <RefactorLog Include="CD67.FicheCollege.BDD.refactorlog" />

+ 23 - 0
CD67.FicheCollege.Entity/ActionCLAS.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Ce code a été généré à partir d'un modèle.
+//
+//     Des modifications manuelles apportées à ce fichier peuvent conduire à un comportement inattendu de votre application.
+//     Les modifications manuelles apportées à ce fichier sont remplacées si le code est régénéré.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace CD67.FicheCollege.Entity
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class ActionCLAS
+    {
+        public string College_Id { get; set; }
+        public Nullable<bool> Action { get; set; }
+        public string Commentaire { get; set; }
+    
+        public virtual College College { get; set; }
+    }
+}

+ 4 - 0
CD67.FicheCollege.Entity/CD67.FicheCollege.Entity.csproj

@@ -59,6 +59,9 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ActionCLAS.cs">
+      <DependentUpon>EntityModel.tt</DependentUpon>
+    </Compile>
     <Compile Include="College.cs">
       <DependentUpon>EntityModel.tt</DependentUpon>
     </Compile>
@@ -77,6 +80,7 @@
       <DesignTime>True</DesignTime>
       <DependentUpon>EntityModel.edmx</DependentUpon>
     </Compile>
+    <Compile Include="Extend\ActionCLAS.cs" />
     <Compile Include="Extend\College.cs" />
     <Compile Include="Extend\Territoire.cs" />
     <Compile Include="Extend\TypeCollege.cs" />

+ 1 - 0
CD67.FicheCollege.Entity/College.cs

@@ -32,5 +32,6 @@ namespace CD67.FicheCollege.Entity
         public virtual Territoire Territoire { get; set; }
         public virtual TypeCollege TypeCollege { get; set; }
         public virtual Identite Identite { get; set; }
+        public virtual ActionCLAS Actions_CLAS { get; set; }
     }
 }

+ 1 - 0
CD67.FicheCollege.Entity/EntityModel.Context.cs

@@ -29,5 +29,6 @@ namespace CD67.FicheCollege.Entity
         public virtual DbSet<Territoire> Territoires { get; set; }
         public virtual DbSet<College> Colleges { get; set; }
         public virtual DbSet<Identite> Identites { get; set; }
+        public virtual DbSet<ActionCLAS> ActionsCLAS { get; set; }
     }
 }

+ 61 - 0
CD67.FicheCollege.Entity/EntityModel.edmx

@@ -5,6 +5,14 @@
     <!-- SSDL content -->
     <edmx:StorageModels>
     <Schema Namespace="ModeleMVC.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" 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">
+        <EntityType Name="Actions-CLAS">
+          <Key>
+            <PropertyRef Name="College_Id" />
+          </Key>
+          <Property Name="College_Id" Type="nvarchar" MaxLength="8" Nullable="false" />
+          <Property Name="Action" Type="bit" />
+          <Property Name="Commentaire" Type="ntext" />
+        </EntityType>
         <EntityType Name="Colleges">
           <Key>
             <PropertyRef Name="Id" />
@@ -80,6 +88,18 @@
           <Property Name="Libelle" Type="nvarchar" MaxLength="255" Nullable="false" />
           <Property Name="Ordre" Type="int" Nullable="false" />
         </EntityType>
+        <Association Name="FK_Actions-CLAS_College">
+          <End Role="Colleges" Type="Self.Colleges" Multiplicity="1" />
+          <End Role="Actions-CLAS" Type="Self.Actions-CLAS" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="Colleges">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Actions-CLAS">
+              <PropertyRef Name="College_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         <Association Name="FK_Colleges_Territoires">
           <End Role="Territoires" Type="Self.Territoires" Multiplicity="0..1" />
           <End Role="Colleges" Type="Self.Colleges" Multiplicity="*" />
@@ -117,10 +137,15 @@
           </ReferentialConstraint>
         </Association>
         <EntityContainer Name="ModeleMVCStoreContainer">
+          <EntitySet Name="Actions-CLAS" EntityType="Self.Actions-CLAS" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Colleges" EntityType="Self.Colleges" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Identites" EntityType="Self.Identites" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="Territoires" EntityType="Self.Territoires" Schema="dbo" store:Type="Tables" />
           <EntitySet Name="TypesCollege" EntityType="Self.TypesCollege" Schema="dbo" store:Type="Tables" />
+          <AssociationSet Name="FK_Actions-CLAS_College" Association="Self.FK_Actions-CLAS_College">
+            <End Role="Colleges" EntitySet="Colleges" />
+            <End Role="Actions-CLAS" EntitySet="Actions-CLAS" />
+          </AssociationSet>
           <AssociationSet Name="FK_Colleges_Territoires" Association="Self.FK_Colleges_Territoires">
             <End Role="Territoires" EntitySet="Territoires" />
             <End Role="Colleges" EntitySet="Colleges" />
@@ -155,6 +180,11 @@
             <End Role="College" EntitySet="Colleges" />
             <End Role="Identite" EntitySet="Identites" />
           </AssociationSet>
+          <EntitySet Name="ActionsCLAS" EntityType="CD67.FicheCollege.ActionCLAS" />
+          <AssociationSet Name="FK_Actions_CLAS_College" Association="CD67.FicheCollege.FK_Actions_CLAS_College">
+            <End Role="College" EntitySet="Colleges" />
+            <End Role="Actions_CLAS" EntitySet="ActionsCLAS" />
+          </AssociationSet>
           </EntityContainer>
         <EntityType Name="TypeCollege">
           <Key>
@@ -201,6 +231,7 @@
           <NavigationProperty Name="Territoire" Relationship="CD67.FicheCollege.FK_Colleges_Territoires" FromRole="College" ToRole="Territoire" />
           <NavigationProperty Name="TypeCollege" Relationship="CD67.FicheCollege.FK_Colleges_TypesCollege" FromRole="College" ToRole="TypeCollege" />
           <NavigationProperty Name="Identite" Relationship="CD67.FicheCollege.FK_FicheIdentite_College" FromRole="College" ToRole="Identite" />
+          <NavigationProperty Name="Actions_CLAS" Relationship="CD67.FicheCollege.FK_Actions_CLAS_College" FromRole="College" ToRole="Actions_CLAS" />
         </EntityType>
         <Association Name="FK_Colleges_Territoires">
           <End Type="CD67.FicheCollege.Territoire" Role="Territoire" Multiplicity="0..1" />
@@ -273,6 +304,27 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <EntityType Name="ActionCLAS">
+          <Key>
+            <PropertyRef Name="College_Id" />
+          </Key>
+          <Property Name="College_Id" Type="String" Nullable="false" MaxLength="8" FixedLength="false" Unicode="true" />
+          <Property Name="Action" Type="Boolean" />
+          <Property Name="Commentaire" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
+          <NavigationProperty Name="College" Relationship="CD67.FicheCollege.FK_Actions_CLAS_College" FromRole="Actions_CLAS" ToRole="College" />
+        </EntityType>
+        <Association Name="FK_Actions_CLAS_College">
+          <End Type="CD67.FicheCollege.College" Role="College" Multiplicity="1" />
+          <End Type="CD67.FicheCollege.ActionCLAS" Role="Actions_CLAS" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="College">
+              <PropertyRef Name="Id" />
+            </Principal>
+            <Dependent Role="Actions_CLAS">
+              <PropertyRef Name="College_Id" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
         </Schema>
     </edmx:ConceptualModels>
     <!-- C-S mapping content -->
@@ -358,6 +410,15 @@
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
+          <EntitySetMapping Name="ActionsCLAS">
+            <EntityTypeMapping TypeName="CD67.FicheCollege.ActionCLAS">
+              <MappingFragment StoreEntitySet="Actions-CLAS">
+                <ScalarProperty Name="Commentaire" ColumnName="Commentaire" />
+                <ScalarProperty Name="Action" ColumnName="Action" />
+                <ScalarProperty Name="College_Id" ColumnName="College_Id" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
         </EntityContainerMapping>
 </Mapping></edmx:Mappings>
   </edmx:Runtime>

+ 2 - 0
CD67.FicheCollege.Entity/EntityModel.edmx.diagram

@@ -12,6 +12,8 @@
         <AssociationConnector Association="CD67.FicheCollege.FK_Colleges_TypesCollege" />
         <EntityTypeShape EntityType="CD67.FicheCollege.Identite" Width="1.875" PointX="5.125" PointY="1.125" />
         <AssociationConnector Association="CD67.FicheCollege.FK_FicheIdentite_College" />
+        <EntityTypeShape EntityType="CD67.FicheCollege.ActionCLAS" Width="1.5" PointX="7.5" PointY="1.125" />
+        <AssociationConnector Association="CD67.FicheCollege.FK_Actions_CLAS_College" />
         </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 26 - 0
CD67.FicheCollege.Entity/Extend/ActionCLAS.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CD67.FicheCollege.Entity
+{
+    /// <summary>
+    /// Classe d'extension de celle d'Entity, nécessaire pour y associer les Metadata
+    /// </summary>
+    [MetadataType(typeof(ActionCLAS_Metadata))]
+    public partial class ActionCLAS
+    {
+    }
+
+    /// <summary>
+    /// Classe contenant les DataAnnotations pour chaque champ
+    /// </summary>
+    public class ActionCLAS_Metadata
+    {
+        [DataType(DataType.MultilineText)]
+        public string Commentaire { get; set; }
+    }
+}

+ 29 - 0
CD67.FicheCollege.Factory/ActionCLASFactory.cs

@@ -0,0 +1,29 @@
+using CD67.FicheCollege.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.Entity;
+
+namespace CD67.FicheCollege.Factory
+{
+    public partial class ActionCLASFactory : Internal.BaseFactory<Entity.ActionCLAS>
+    {
+        public override Entity.ActionCLAS getById(params object[] keyValues)
+        {
+            //si l'élément n'existe pas, on le créé
+            Entity.ActionCLAS action = base.getById(keyValues);
+            if(action == null)
+            {
+                string id = keyValues[0].ToString();
+                action = new ActionCLAS()
+                {
+                    College_Id = id
+                };
+                this.add(ref action);
+            }
+
+            return action;
+        }
+    }
+}

+ 4 - 0
CD67.FicheCollege.Factory/CD67.FicheCollege.Factory.csproj

@@ -55,7 +55,11 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="CollegeFactory.cs" />
+    <Compile Include="ActionCLASFactory.cs" />
     <Compile Include="IdentiteFactory.cs" />
+    <Compile Include="Internal\ActionCLASFactory.cs">
+      <DependentUpon>GenericFactories.tt</DependentUpon>
+    </Compile>
     <Compile Include="Internal\CollegeFactory.cs">
       <DependentUpon>GenericFactories.tt</DependentUpon>
     </Compile>

+ 21 - 0
CD67.FicheCollege.Factory/Internal/ActionCLASFactory.cs

@@ -0,0 +1,21 @@
+using CD67.FicheCollege.Entity;
+using System.Linq;
+
+namespace CD67.FicheCollege.Factory
+{
+	/// <summary>
+    /// NE PAS MODIFIER
+    /// C'est une classe partielle, elle peut être complétée avec une classe partielle du même nom
+    /// Factory générée automatiquement à l'aide du fichier GenericFactories.tt
+    /// pour toutes les entités du fichier entity : /CD67.FicheCollege.Entity/EntityModel.edmx
+    /// </summary>
+	public partial class ActionCLASFactory : Internal.BaseFactory<Entity.ActionCLAS>
+	{
+		/// <summary>
+        /// Constructeur public lié au constructeur de base
+        /// </summary>
+        /// <param name="dbContext">Context Entity Framework utilisé dans la classe</param>
+		public ActionCLASFactory(Entities dbContext) : base(dbContext) { }
+	}
+}
+