LINQ动态数据网站

问题描述

请各位大大指点一下关于LINQ动态数据网站的问题,谢谢代码如下Default.aspx.csusingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Xml.Linq;usingSystem.Web.DynamicData;publicpartialclass_Default:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){System.Collections.IListvisibleTables=MetaModel.Default.VisibleTables;if(visibleTables.Count==0){thrownewInvalidOperationException("没有可访问的表。请确保至少在Global.asax中注册了一个数据模型并启用了支架,或者实现自定义页。");}Menu1.DataSource=visibleTables;Menu1.DataBind();}}

Global.asax<%@ApplicationLanguage="C#"%><%@ImportNamespace="System.Web.Routing"%><%@ImportNamespace="System.Web.DynamicData"%><scriptRunAt="server">publicstaticvoidRegisterRoutes(RouteCollectionroutes){MetaModelmodel=newMetaModel();model.RegisterContext(typeof(DataClassesDataContext),newContextConfiguration(){ScaffoldAllTables=true});routes.Add(newDynamicDataRoute("{table}/{action}.aspx"){Constraints=newRouteValueDictionary(new{action="List|Details|Edit|Insert"}),Model=model});}voidApplication_Start(objectsender,EventArgse){RegisterRoutes(RouteTable.Routes);}</script>

DataClasses.designer.cs#pragmawarningdisable1591usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Data.Linq;usingSystem.Data.Linq.Mapping;usingSystem.Linq;usingSystem.Linq.Expressions;usingSystem.Reflection;publicpartialclassDataClassesDataContext:System.Data.Linq.DataContext{privatestaticSystem.Data.Linq.Mapping.MappingSourcemappingSource=newAttributeMappingSource();#region可扩展性方法定义partialvoidOnCreated();#endregionpublicDataClassesDataContext(stringconnection):base(connection,mappingSource){OnCreated();}publicDataClassesDataContext(System.Data.IDbConnectionconnection):base(connection,mappingSource){OnCreated();}publicDataClassesDataContext(stringconnection,System.Data.Linq.Mapping.MappingSourcemappingSource):base(connection,mappingSource){OnCreated();}publicDataClassesDataContext(System.Data.IDbConnectionconnection,System.Data.Linq.Mapping.MappingSourcemappingSource):base(connection,mappingSource){OnCreated();}}#pragmawarningrestore1591

生成网站后提示错误如下“/”应用程序中的服务器错误。没有为该对象定义无参数的构造函数。说明:执行当前Web请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。异常详细信息:System.MissingMethodException:没有为该对象定义无参数的构造函数。源错误:行6:publicstaticvoidRegisterRoutes(RouteCollectionroutes){行7:MetaModelmodel=newMetaModel();行8:model.RegisterContext(typeof(DataClassesDataContext),newContextConfiguration(){ScaffoldAllTables=true});行9:routes.Add(newDynamicDataRoute("{table}/{action}.aspx"){行10:Constraints=newRouteValueDictionary(new{action="List|Details|Edit|Insert"}),源文件:e:tsjWEBGlobal.asax行:8堆栈跟踪:[MissingMethodException:没有为该对象定义无参数的构造函数。]System.RuntimeTypeHandle.CreateInstance(RuntimeTypetype,BooleanpublicOnly,BooleannoCheck,Boolean&canBeCached,RuntimeMethodHandle&ctor,Boolean&bNeedSecurityCheck)+0System.RuntimeType.CreateInstanceSlow(BooleanpublicOnly,BooleanfillCache)+86System.RuntimeType.CreateInstanceImpl(BooleanpublicOnly,BooleanskipVisibilityChecks,BooleanfillCache)+230System.Activator.CreateInstance(Typetype,BooleannonPublic)+67System.Web.DynamicData.<>c__DisplayClass1.<RegisterContext>b__0()+9System.Web.DynamicData.MetaModel.RegisterContext(Func`1contextFactory,ContextConfigurationconfiguration)+336System.Web.DynamicData.MetaModel.RegisterContext(TypecontextType,ContextConfigurationconfiguration)+79ASP.global_asax.RegisterRoutes(RouteCollectionroutes)ine:tsjWEBGlobal.asax:8ASP.global_asax.Application_Start(Objectsender,EventArgse)ine:tsjWEBGlobal.asax:31[HttpException(0x80004005):没有为该对象定义无参数的构造函数。]System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContextcontext,HttpApplicationapp)+2727622System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtrappContext,HttpContextcontext,MethodInfo[]handlers)+128System.Web.HttpApplication.InitSpecial(HttpApplicationStatestate,MethodInfo[]handlers,IntPtrappContext,HttpContextcontext)+188System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtrappContext,HttpContextcontext)+295System.Web.HttpApplicationFactory.GetPipelineApplicationInstance(IntPtrappContext,HttpContextcontext)+56System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtrappContext)+231[HttpException(0x80004005):没有为该对象定义无参数的构造函数。]System.Web.HttpRuntime.FirstRequestInit(HttpContextcontext)+8923723System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContextcontext)+85System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequestwr,HttpContextcontext)+333

解决方案

本帖最后由 hentaidd 于 2014-10-08 20:46:41 编辑
解决方案二:
这个类ContextConfiguration没有无参的构造函数吧?
解决方案三:
添加了还是提示没有无参数的构造函数publicclassContextConfiguration{publicContextConfiguration(){/*这是一个无参的构造函数*/}}错误列表显示如下错误4未知的服务器标记“asp:DynamicValidator”。
解决方案四:
引用2楼hentaidd的回复:

添加了还是提示没有无参数的构造函数publicclassContextConfiguration{publicContextConfiguration(){/*这是一个无参的构造函数*/}}错误列表显示如下错误4未知的服务器标记“asp:DynamicValidator”。

要引用System.Web.DynamicData
解决方案五:
无参构造是指DataClassesDataContext

时间: 2024-07-28 19:33:33

LINQ动态数据网站的相关文章

谢谢-如何用echarts图表获取后台json数据变成动态数据,

问题描述 如何用echarts图表获取后台json数据变成动态数据, 网站首页是用echarts图表布局的数据,但是是静态的,需要送后台获取json数据生成动态数据,新手不知道怎么搞? 解决方案 使用ajax,向后台请求获取json数据 解决方案二: http://www.w3school.com.cn/jquery/ajax_ajax.asp ajax从动态页获取到数据后再生成echarts,将数据赋值给echarts相关配置

JS实现table表格数据排序功能(可支持动态数据+分页效果)_javascript技巧

asp.net会经常遇到分页的效果,尤其是希望实现静态的html分页排序(html分页相信大家都已经有自己的解决方案.在这里就不多说).我写了一个简单的Demo排序. 数据就是字母和数字两组.(汉字需要找到asc码) 原理就是利用数组自带的sort排序,进行表格重组.已在.net mvc 中测试过.支持分页.(申明一点.只对当前页面数据排序 无刷新,对所有页面排序的话,肯定需要刷新.这点我还在解决中.)希望有新想法的高手们,给下指点. 下面把html的代码贴出来: <!DOCTYPE HTML

揭秘云编程:可以处理动态数据的Bloom语言

Joseph Hellerstein想让云编程达到一个新的高度 最新出版的MIT技术评论5/6月合刊登出了MIT评出的2010年度十大新兴技术,其中IT领域的发明占有重要的位置,大家一定注意到其中有一项是云编程(Cloud Programing)而不是云计算(Cloud computing).云计算作为一项巨大的平台变革,吸引了包括电信运营商,互联网提供商等多方利益体的角逐,但开发者在云计算时代的作用及前景却不很清晰,难道程序员的工作就只限于转换现有的程序到云平台上吗? MIT技术评论选择云编程

如何实现100%的动态数据管道(二)

动态|数据 主要思路解决了,下面开始写详细设计(以Sybase ASE数据库为例,其他各位扩展):             1.建立中间层表vdt_columns,这个表的属性用于构建管道中的列资料.             执行类似的代码生成:             ls_sql = "create table vdt_columns ("            ls_sql +="uid              int             null    ,&qu

如何实现100%的动态数据管道(三)

动态|数据 下面看看,如何根据中间层的数据,构建管道语法: 1.首先建立一个数据窗口对象:d_vdtcolumns SQL语法是:  SELECT vdt_columns.utid,            vdt_columns.uid,            vdt_columns.upkey,            vdt_columns.udmid,            vdt_columns.udmname,            vdt_columns.unulls,        

用asp+javascript实现动态数据联动,不刷新

javascript|动态|数据|刷新 /////////////by xxrl(孔曰成仁,孟曰取E) /////////////Chinese:蒋健华 /////////////email:jjh_115@eyou.com 联动,联动,联动....困扰了好多网友的神经,在CSDN-ASP板块中,总是看到网友们大呼救命,救什么?联动!为什么联动这样受到关注,其实用性无可非议,用户也能认可,可是如果数据是大量并相互关联的,那问题就来了,怎么识别并显示是一个很苦恼的问题.那究竟有没有一个很好的解决办

用ADO的COMMAND对象实现对WEB数据库动态数据查询的方法

用ADO的COMMAND对象实现对WEB数据库动态数据查询的方法★ 林碧英众所周知,由于ASP技术的出现,使得Intranet的应用更加广泛深入.相当多的企业都建立了企业内部综合查询系统,如何快速.准确地查询企业内部信息是编写基于WEB技术应用程序必须要解决的主要问题.ASP提供了用ADO内置的3个主要对象Recordset.Connection和Command对WEB数据库进行操作.其中Connection的主要功能是建立与WEB数据库的链接:Command的主要功能是向WEB数据库传送数据查

创建动态数据输入用户界面

创建|动态|数据 下载实例 简介 当创建数据驱动的 Web 站点时,Web 开发人员遇到的最常见的任务之一就是创建数据输入窗体.数据输入窗体是为系统用户提供数据输入方法的 Web 页.创建特定数据输入窗体的任务通常应该先从需求分析入手,即,明确指出需要从用户收集何种信息.需求确定之后,下一步是设计数据输入 Web 窗体,包括创建图形用户界面以及编写根据用户输入更新数据库的代码. 当数据输入窗体需求事先已知,并且此数据输入窗体对系统中所有用户都一样时,创建这样的输入窗体就毫无挑战性.然而,如果需要

Visual Basic动态数据驱动程序浅析

Visual Basic应用程序经常使用先进的ActiveX组件连接到数据源.这些数据来源可能包括数据访问对象(DAO)的使用,远程数据对象(RDO),OLE DB提供程序,如ActiveX数据对象(ADO),COM数据提供商,水晶数据对象(CDO)和水晶数据源类型库,或Visual Basic数据控件.使用水晶报表的Visual Basic动态数据驱动程序,您可以让您的应用程序使用这些相同的ActiveX数据源. Visual Basic动态数据驱动程序包括: ◆Crystal Reports