Kann nicht implizit konvertiert Typ 'System.Sammlungen.Generisches.Liste<AnonymousType#1>' zu 'System.Sammlungen.Generisches.IEnumerable

Nun, dass im Versuch der Right Join Eine Ausnahme Auftauchte.

Dies ist mein Controller

   public IEnumerable<APPLICANT> GetApplicant()
    {
        IEnumerable<APPLICANT> applicantdata = Cache.Get("applicants") as IEnumerable<APPLICANT>;
        IEnumerable<Profile> profiledata = Cache.Get("profiles") as IEnumerable<Profile>;


        if (applicantdata == null)
        {

            var applicantList = (from a in context.Profiles 
                                 join app in context.APPLICANTs
                                 on a.PROFILE_ID equals app.Profile_id into joined
                                 from j in joined.DefaultIfEmpty()
                                 select new
                                            {
                                               APPLICANT = j, 
                                               Profile = a,
                                            }).Take(1000).AsEnumerable();

                   applicantdata = applicantList.AsEnumerable().ToList();


            if (applicantdata.Any())
            {
                Cache.Set("applicants", applicantdata, 30);
            }
        }
        return applicantdata;

    }

Dies ist der Fehler, auf

 applicantdata = applicantList.AsEnumerable().ToList();

Kann nicht implizit konvertiert Typ 'System.Sammlungen.Generisches.Liste<AnonymousType#1>'
'System.Sammlungen.Generisches.IEnumerable<Antragsteller.Modelle.ANTRAGSTELLER>'. Eine explizite
Konvertierung vorhanden ist (fehlt ein cast?)

Wie definieren Sie APPLICANT?
möglich, Duplikat der kann Nicht implizit konvertiert type 'List<AnonymousType#1>', 'IEnumerable<Modelle.ANTRAGSTELLER>'
Wenn Sie mit IEnumerable<Applicant> als Rückgabetyp, warum dann erstellen Sie einen Anonymen Typ in der LINQ?? Sie benötigen select new Applicant{ }

InformationsquelleAutor Enrique Gil | 2013-05-20

Schreibe einen Kommentar