我们专注孝感网站设计 孝感网站制作 孝感网站建设
成都网站建设公司服务热线:18982081108

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

【C#】ADO.NetEntitiesFramework使用查询语句时遇到的错误

XAML代码:

10年积累的网站制作、成都网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先建设网站后付款的网站建设流程,更有禅城免费网站建设让你可以放心的选择与我们合作。

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        xmlns:local="clr-namespace:WpfApplication72"

        mc:Ignorable="d"

        Title="MainWindow" Height="350" Width="525">

   

       

   

隐藏代码:

using System;

using System.Collections.Generic;

using System.Collections.ObjectModel;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Navigation;

using System.Windows.Shapes;

namespace WpfApplication72

{

    ///

    /// Interaction logic for MainWindow.xaml

    ///

    public partial class MainWindow : Window

    {

        private Formula1v2Entities data = new Formula1v2Entities();

        public MainWindow()

        {

            InitializeComponent();

            

            this.DataContext = collection;

        }

        public IEnumerablecollection

        {

            get

            {

                return (from r in data.Racers

                       select new

                       {

                         Id=r.Id,

                         FirstName=r.FirstName,

                         LastName=r.LastName,

                         Nationality=r.Nationality

                       }).ToList();

            }

        }

    }

}

在隐藏代码中如果没有ToList()方法的话,运行程序会报如下的错误:

Additional information: Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported. Instead populate a DbSet with data, for example by calling Load on the DbSet, and then bind to local data. For WPF bind to DbSet.Local. For WinForms bind to DbSet.Local.ToBindingList(). For ASP.NET WebForms you can bind to the result of calling ToList() on the query or use Model Binding,

for more information see http://go.microsoft.com/fwlink/?LinkId=389592.

参考链接:

https://www.devexpress.com/Support/Center/Question/Details/Q580427


当前名称:【C#】ADO.NetEntitiesFramework使用查询语句时遇到的错误
文章转载:http://www.ytofo.com/article/pjiddg.html

免费获取网站设计制作与品牌网站建设策划方案报价

网站设计 + 品牌建站,策划方案 + 精准报价,现在免费领!品牌要升级,官网先发力!免费领取网站设计制作方案 + 精准报价,专业团队帮你落地
提交需求

    联系我们

    18980820575
  • 手机:13518219792
  • 地址:湖北孝感市大悟城关镇鄂北物流城13栋125号
  • 24小时服务热线:18982081108

    网站建设服务

  • 网页设计
  • 网站制作
  • 网站开发

    网站推广服务

  • 营销网站建设
  • 百度快速排名
  • 整站网站推广

    网站运维服务

  • 基础维护
  • 网站改版
  • 网站维护

    FOLLOW US

  • 微信二维码

    微信二维码

Copyright © 2025 湖北孝感网站建设公司 湖北孝感网站建设公司-选我们!湖北专业的孝感网站制作公司!
All Rights Reserved 版权所有 鄂ICP备2025125038号-8