Int.Analyser dans l'Expression Linq

J'ai suivantes expression linq. Je veux calculer la somme des valeurs numériques de type Nvarchar champ. Je utiliser le code suivant pour ce faire. Mais j'obtiens une erreur lorsque je tente de l'exécuter.

        var m = new MaterialModelContainer();

        var list = (from x in
                        (
                            from inv in m.INVs
                            join l in m.LIBs on inv.MESC equals l.MESC
                            join o in m.OUTs on inv.MESC equals o.MESC
                            join t in m.TRANs on inv.MESC equals t.MESC
                            where t.TYPE == "60"
                            select new
                                {
                                    l.MESC,
                                    l.LINE_NO,
                                    l.UNIT_LINE,
                                    Description = l.DES + " " + l.PART_NO,
                                    inv.NEW_QTY,
                                    o.PJ,
                                    o.DATE,
                                    o.QTY,
                                    o.QTY_REC,
                                    TranQty = t.QTY,
                                    tranDate = t.DATE

                                }
                        )
                    group x by
                        new
                            {
                                x.MESC,
                                x.LINE_NO,
                                x.UNIT_LINE,
                                x.Description,
                                x.NEW_QTY,
                                x.PJ,
                                x.DATE,
                                x.QTY,
                                x.QTY_REC
                            }
                    into g
                    select new
                        {
                            QTY_Consum_1 = g.Where(c => int.Parse(c.tranDate) >= cuDate && int.Parse(c.tranDate) <= endDate).Sum(d => int.Parse(d.TranQty))

                        }
                   ).ToList();

Description De L'Erreur:

LINQ to entities ne reconnaît pas la méthode 'Int32
Parse(System.String)', et cette méthode ne peut pas être traduit
dans un magasin d'expression

Comment puis-je résoudre ce problème et d'écrire ce code mieux que cela?

j'ai modifier le code pour cette

 select new
                            {
                                QTY_Consum_1 = g.Where(c => SqlFunctions.StringConvert(c.tranDate) >= cuDate && SqlFunctions.StringConvert(c.tranDate) <= endDate).Sum(d => SqlFunctions.StringConvert(d.TranQty)),
                               g.Key.MESC
                            }
                       ).ToList();

mais cette erreur
Int.Analyser dans l'Expression Linq

Peut-être que cette réponse va vous aider: Convertir un string en int en EF 4.0

OriginalL'auteur Pouya | 2012-08-25