BONJOUR

je suis débutante en .net et tout aide, conseille et bonne pratique sera la bien venu

peux je utiliser l'entity framwork code first pour faire la conception et creer une base de données?

est ce que on peut convertir de MCD suivent:

Nom : mcddra2.png
Affichages : 196
Taille : 10,2 Ko

Et

Nom : mcddra2.png
Affichages : 204
Taille : 12,1 Ko

vers Entity framwork code_first suivant:

entité compte de charrge


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace BusinessEntites
{
    public class CompteCharge
    {
        public int Id { get; set; }
 
        [DisplayName("Compte SCF")]
        public string CptCharge { get; set; }
 
        [DisplayName("Libelle")]
        public string Designation { get; set; }
 
        public virtual ICollection<CompteAnalytique> CompteAnalytique { get; set; }
 
        public virtual ICollection<DepenseDRA> DepenseDRA { get; set; }
        public virtual ICollection<Structure> Structure { get; set; }
    }
}
entité compte analytique

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace BusinessEntites
{
    public class CompteAnalytique
    {
        public int Id { get; set; }
 
        [DisplayName("Compte Analytique")]
        [StringLength(3)]
        public string CptAnal { get; set; }
 
        public string Designation { get; set; }
 
        public virtual ICollection<CompteCharge> CompteCharge { get; set; }
 
        public virtual ICollection<DepenseDRA> DepenseDRA { get; set; }
        public virtual ICollection<Structure> Structure { get; set; }
    }
}

entité Dépense DRA


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace BusinessEntites
{
    public class DepenseDRA
    {
        public int Id { get; set; }
 
        [DisplayName("N° Bon Petite Caisse")]
        public int NumBonPetiteCaisse { get; set; }
 
        [DisplayName("Débit")]
        public double Debit { get; set; }
        public string Libelle { get; set; }
 
        [DisplayName("Date")]
        [DisplayFormat(DataFormatString = "{0,dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        public DateTime DateDepense { get; set; }
 
        [DisplayName("Fournisseur/Préstataire")]
        public string FournisseurOuPrestataire { get; set; }
 
        [DisplayName("N° Facture")]
        public int NumFacture { get; set; }
 
        [DisplayName("Identifiant Fiscal")]
        public string IdentFiscal { get; set; }
 
        [DisplayName("N° Article")]
        public string NumArticle { get; set; }
 
        [DisplayName("N° Bon Commande")]
        public string NumBonCommande { get; set; }
 
        [DisplayName("Assujetti à la TVA")]
        public bool AssujettiTVA { get; set; }
 
        [DisplayName("Déstinataire")]
        public string Destinataire { get; set; }
 
        public int DRAId { get; set; }
 
        [ForeignKey("CompteCharge")]
        public int CompteChargeId { get; set; }
 
        [ForeignKey("CompteAnalytique")]
        public int CompteAnalytiqueId { get; set; }
 
        public virtual DRA DRA { get; set; }
        public virtual CompteCharge CompteCharge{ get; set; }
        public virtual CompteAnalytique CompteAnalytique{ get; set; }
 
    }
}

Entité Structure


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
 
namespace BusinessEntites
{
    public class Structure
    {
        public int StructureId { get; set; }
        [RegularExpression(@"[A-Z]")]
        public string Code { get; set; }
 
        public string Nom { get; set; }
 
        [DisplayName("Nom de Responsable")]
        public string NomResponsable { get; set; }
 
        [DisplayName("Fond fixe (Montant de caisse regié)")]
        public double FondFixe { get; set; }
 
        [DisplayName("Compte caisse regié")]
        [StringLength(5)]
        public string CompteCaisseRegie { get; set; }
 
        [DisplayName("Compte Analytique Caisse Regié")]
        [StringLength(3)]
        public string CompteAnalytiqueCRG { get; set; }
 
        [DisplayName("Compte Analytique Caisse Regié")]
        public Enum TypeStructure { get; set; }
 
        public virtual ICollection<DRA> DRA { get; set; }
 
        public virtual ICollection<CompteCharge> CompteCharge { get; set; }
 
        public virtual ICollection<CompteAnalytique> CompteAnalytique { get; set; }
 
        public virtual ICollection<SequenceDRA> SequenceDRA { get; set; }
 
        public virtual ICollection<MonnaieEspece> MonnaieEspece { get; set; }
 
        public int? StructureHierId { get; set; }
 
        [ForeignKey("StructureId")]
        public virtual Structure StructureHierarchique { get; set; }
    }
}