2017-04-26 17 views
0

ためのモデルと一致していません私のインターンシップのためのソフトウェアを作っていますが、私は他の人のコードを続けています。問題は、2日前に私はVisual Studio 2017でプロジェクトを構築し、うまくいきましたが、もう動作しません。何らかの関係で何かをしようとすると、この「エンティティタイプ...」エラーが発生します(ないそれらのすべて)エンティティタイプ<entity>は、私はすでに日間検索してきた、まだ答えを見つけられませんでしたので、私は君たちを聞いてるのよ、あなたは私が</p> <p>に私を助けることを願って、現在のコンテキスト

例として:

HDPreDiagエンティティクラスは

public partial class HDPreDiagEntities : DbContext 
{ 
    public HDPreDiagEntities() 
     : base("name=HDPreDiagEntities") 
    { 
    } 

    protected override void OnModelCreating(DbModelBuilder modelBuilder) 
    { 
     throw new UnintentionalCodeFirstException(); 
    } 

    public virtual DbSet<Equipement> Equipements { get; set; } 
    public virtual DbSet<FichePreDiag> FichePreDiags { get; set; } 
    public virtual DbSet<Text> Texts { get; set; } 
    public virtual DbSet<TypePanne> TypePannes { get; set; } 
    public virtual DbSet<User> Users { get; set; } 
    public virtual DbSet<HistoriqueMail> HistoriqueMails { get; set; } 
    public virtual DbSet<Pointage> Pointages { get; set; } 
    public virtual DbSet<Rapport> Rapports { get; set; } 
} 
です。ここ

try 
     { 
      using (var ctx = new HDPreDiagEntities()) 
      { 
       return ctx.FichePreDiags.Where(f => f.id == idFiche).First(); 
      } 
     } 

を呼び出し

DAO.FichePreDiag f = BP.getFicheById(r.idFiche); 

FichePrediagクラス:

私は理解していない10

事は、それが働いたと、突然、もはや機能していなかったということですが、私はそれをあなたの助け

おかげ

編集を得ることはありません

public partial class FichePreDiag 
{ 
    [DatabaseGenerated(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity)] 

    public int id { get; set; } 
    public System.DateTime DateCreation { get; set; } 
    public bool telMail { get; set; } 
    public string interlocuteurHD { get; set; } 
    public string nomClient { get; set; } 
    public string classificationClient { get; set; } 
    public bool commentaireClient { get; set; } 
    public bool acreerClient { get; set; } 
    public bool amodifierClient { get; set; } 
    public string idClient { get; set; } 
    public string nomInterlocuteur { get; set; } 
    public string mailInterlocuteur { get; set; } 
    public string telephoneInterlocuteur { get; set; } 
    public bool acreerInterlocuteur { get; set; } 
    public bool amodifierInterlocuteur { get; set; } 
    public string identificationHD { get; set; } 
    public string typeMachine { get; set; } 
    public string cn { get; set; } 
    public string identificationClient { get; set; } 
    public bool acreerMachine { get; set; } 
    public bool etiquetteMachine { get; set; } 
    public bool amodifierMachine { get; set; } 
    public bool maintenancePropose { get; set; } 
    public Nullable<int> numIntervention { get; set; } 
    public string technicienPrecedent { get; set; } 
    public Nullable<int> degresUrgence { get; set; } 
    public bool majorationUrgence { get; set; } 
    public string panne { get; set; } 
    public string descriptif { get; set; } 
    public string typeContrat { get; set; } 
    public Nullable<int> nbHeure { get; set; } 
    public Nullable<System.DateTime> datePropose { get; set; } 
    public Nullable<System.DateTime> dateConfirmee { get; set; } 
    public string dialogueClient { get; set; } 
    public string Equipements { get; set; } 
    public string Fournitures { get; set; } 
    public bool isArchived { get; set; } 
    public Nullable<System.DateTime> LastMaintenance { get; set; } 
    public string idInterlocuteur { get; set; } 
    public string typepanne1 { get; set; } 
    public string typepanne2 { get; set; } 
    public string Techniciens { get; set; } 
    public Nullable<System.DateTime> NextMaintenance { get; set; } 
    public string motifAppel { get; set; } 
    public string cds { get; set; } 
    public string bi { get; set; } 
    public string statusCDS { get; set; } 
    public string fonctionInterlocuteur { get; set; } 
    public List<string> NomDemandeAide { get; set; } 
    public List<Nullable<System.DateTime>> DateTimeDemandeAide { get; set; } 
    public string NomDemandeDevis { get; set; } 
    public Nullable<System.DateTime> DateTimeDemandeDevis { get; set; } 
    public string nomInterlocuteurSurPlace { get; set; } 
    public string fonctionInterlocuteurSurPlace { get; set; } 
    public string mailInterlocuteurSurPlace { get; set; } 
    public string telephoneInterlocuteurSurPlace { get; set; } 
    public Nullable<System.DateTime> DatePlanificationDeb { get; set; } 
    public Nullable<System.DateTime> DatePlanificationFin { get; set; } 
    public Nullable<decimal> tarifBiPrice { get; set; } 
    public string tarifBiNom { get; set; } 

    public string telMailString { get { return (this.telMail) ? "Téléphone" : "Mail/Fax"; } } 
    public string typeModifClientString { get { return (this.acreerClient) ? "A CREER" : "A MODIFIER"; } } 
    public string typeModifInterlocuteurString { get { return (this.acreerInterlocuteur) ? "A CREER" : "A MODIFIER"; } } 
    public string commentaireString { get { return (this.commentaireClient) ? "Oui" : "Non"; } } 
    public string refMachineHD { get { return this.identificationHD.Split(' ')[0]; } } 

    public bool demandeAideFilled { get { return (this.NomDemandeAide != null); } } 
    public bool demandeAideFilledAndItsMine { get { return (this.NomDemandeAide != null && isMine()); } } 
    public bool demandeDevisFilled { get { return (this.NomDemandeDevis != null); } } 
    public bool demandeDevisFilledAndItsMine { get { return (this.NomDemandeDevis != null && DAL.getUserByUsername(Environment.UserName).fullName.Equals(this.NomDemandeDevis)); } } 

    /// <summary> 
    /// Fonction qui permet de vérifier si un technicien a été sollicité pour de l'aide. 
    /// </summary> 
    public bool isMine() {/* 
     foreach(string nomTechnicien in this.NomDemandeAide) { 
      if(DAL.getUserByUsername(Environment.UserName).fullName.Equals(nomTechnicien)) 
       return true; 
     } 
     return false;*/ 

     return this.NomDemandeAide.Contains(DAL.getUserByUsername(Environment.UserName).fullName); 
    } 

    /// <summary> 
    /// Fonction qui permet de retirer un technicien de la liste des techniciens sollicités pour de l'aide.  
    /// </summary> 
    public void removeFromHelp() 
    { 
     this.NomDemandeAide.Remove(DAL.getUserByUsername(Environment.UserName).fullName); 
    } 

    public string interlocuteurHDInitiale 
    { 
     get 
     { 
      string ret = ""; 
      foreach (char c in this.interlocuteurHD.ToCharArray()) 
      { 
       if (char.IsUpper(c)) 
        ret += c; 
      } 
      return ret; 
     } 
    } 

    public string techniciensString 
    { 
     get 
     { 
      string ret = ""; 
      string[] ss = this.Techniciens.Split(';'); 
      for (int i = 0; i < ss.Length - 1; i++) 
      { 
       if (i == 0) 
        ret = ss[i]; 
       else if (i == ss.Length - 2) 
        ret += " et " + ss[i]; 
       else 
        ret += ", " + ss[i]; 
      } 
      return ret; 
     } 
    } 

    public string NumSuivi 
    { 
     get 
     { 
      string ret = ""; 
      if (id < 1000000) 
      { 
       ret += "0"; 
       if (id < 100000) 
       { 
        ret += "0"; 
        if (id < 10000) 
        { 
         ret += "0"; 
         if (id < 1000) 
         { 
          ret += "0"; 
          if (id < 100) 
          { 
           ret += "0"; 
           if (id < 10) 
            ret += "0"; 
          } 
         } 
        } 
       } 
      } 
      return ret + id.ToString(); 
     } 
    } 
} 
+0

持っているので、私は戻ってそれを文字列に変更しなければならなかった...リストに「nomDemandeAide」(文字列)を変更しなければなりませんでしたあなたは[リンク](http://stackoverflow.com/questions/4983108/the-entity-type-classname-is-not-part-of-the-model-for-the-current-context)この解決策を試しましたか? – nocodename

+0

結果なしで試しました:/ –

+0

エンティティの例外をスローする行はどれですか?あなたのコードが不完全であると思われ、エンティティ構造にもっと詳細を提供し、その方法で何をすべきかを示します。 –

答えて

0

わかりました、私は私が共同でfunctionnalityを変えた神は、私が

愚かxDさんよ、問題は何であったかを考え出しましたデ、私はDateTimeDemandeAide

と同じことがあなたの助けみんなありがとう:)

関連する問題

 関連する問題