0
jsonの文字列に小数点以下の値を返すWebサービスがありますが、代わりに400.00〜400の数字に丸めますが、400.50の場合は400.50を返します私はその形式で400.00から400webserviceは小数点以下を四捨五入して返します
エラー
{"Message":"LINQ to Entities does not recognize the method \u0027System.String ToString(System.String)\u0027 method, and this method cannot be translated into a store expression.","
コード
Products = ( from p in db.Products where p.DepartmentId == qDepartment.Id join i in db.ProductImages on p.Id equals i.ProductId into products from x in products.Where(y => y.Dimension == "180X180") select new Product { Id = p.Id, Title = p.Title, ShortDescription = p.ShortDescription, Brand = p.Brand, Model = p.Model, Image = x.Path, FriendlyUrl = p.FriendlyUrl, SellPrice = p.SellPrice.ToString("N2")/*Error Here changed type to string*/, DiscountPercentage = p.DiscountPercentage, Votes = p.Votes, TotalRating = p.TotalRating }).ToList();ある値を返しますどのようにしたいです
私はあなたの例ですが、Linq To Entitiesエラーあなたは回避できることを知っています – ONYX
私はConvert.ToString()と同じ問題を解決しようとしました – ONYX
ああ、私はエンティティにLINQを使っていたことを知りませんでした - 今私たちはそれについて何ができるかを見てみましょうそのビットの情報も同様に –