我已经找了几天但仍然找不到答案,所以我问你们,希望你能帮助我
我正在为我的实习构建一个软件,但我只是继续其他人的代码。问题是,2天前我用Visual Studio 2017构建了这个项目,它工作正常,现在它不再工作了,当我尝试用某些关系做某事时,我得到了这个“实体类型......”错误(不是全部)
举个例子:
DAO.FichePreDiag f = BP.getFicheById(r.idFiche);
调用
try
{
using (var ctx = new HDPreDiagEntities())
{
return ctx.FichePreDiags.Where(f => f.id == idFiche).First();
}
}
这是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; }
}
我不明白的是,它起作用了,突然间不再起作用,我没有得到它
感谢您的帮助
编辑:
FichePrediag课程:
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 :(得分:0)
好吧我弄清楚问题是什么,上帝我是愚蠢的xD
我在代码中更改了一个functionnality,所以我不得不将“nomDemandeAide”(字符串)更改为List ...所以我只需将其更改回字符串,与DateTimeDemandeAide相同
谢谢你们的帮助:)