zoukankan      html  css  js  c++  java
  • DataTables.Queryable Sample

    1、DataTables.Queryable的例子项目使用了SQL Server CE数据库,花了几分钟时间转为使用LocalDB。

    完整Web.config文件如下:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=301880
      -->
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
      </configSections>
      <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5.2" />
        <httpRuntime targetFramework="4.5.2" />
        <customErrors mode="On" defaultRedirect="/">
          <error statusCode="404" redirect="/" />
        </customErrors>
      </system.web>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <contexts>
          <context type="DataTables.Queryable.Samples.Database.DatabaseContext, DataTables.Queryable.Samples">
            <databaseInitializer type="DataTables.Queryable.Samples.Database.DatabaseInitializer, DataTables.Queryable.Samples" />
          </context>
        </contexts>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
          <parameters>
            <parameter value="MSSQLLocalDB" />
          </parameters>
        </defaultConnectionFactory>
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
      <connectionStrings>
        <add name="DataTables.Queryable.Samples.Database.DatabaseContext" connectionString="Data Source=(LocalDb)MSSQLLocalDB;Initial Catalog=DataTables.Queryable.Samples.Database;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
      </connectionStrings>
    </configuration>
    View Code

    注:版本为1.7.2.0

    注2:要把DatabaseContext.cs文件中的DatabaseInitializer类从DatabaseContext类中移出来,不要作为嵌入类

    2、在家里下载了代码之后打开项目提示如下错误:

    error : 未找到导入的项目“C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuildMicrosoftVisualStudiov14.0WebApplicationsMicrosoft.WebApplication.targets”。此外,请尝试在 $(MSBuildExtensionsPath32) - "C:Program Files (x86)MSBuild" 的回退搜索路径中查找“MicrosoftVisualStudiov14.0WebApplicationsMicrosoft.WebApplication.targets”。

    解决办法:手工打开.csproj文件,找到这样一行,把14改成15即可

    <Import Project="$(MSBuildExtensionsPath32)MicrosoftVisualStudiov14.0WebApplicationsMicrosoft.WebApplication.targets" />
  • 相关阅读:
    Json对象处理.将对象处理成dic数组.
    asp.net core 创建允许跨域请求的api, cors.
    (转载)dotnet core 中文乱码 codepages
    (转载)Memcached和Redis简介
    发送Json数据,WebApi查看时为Null的问题(已解决)
    Vs2017获取Git空仓库后创建解决方案及项目无法推送,推送失败的问题.
    前端:Jquery 处理同一Name的Radio组时,绑定checked属性异常的问题.(已解决)
    Vs2015 本地git获取的代码目录文件修改后,启动提示error:Unable to start program “C:Program Filesdotnetdotnet.exe” 已解决.
    .net core 发布后提示Start error
    .net core vs2015 vs2017打开后errpr
  • 原文地址:https://www.cnblogs.com/s5689412/p/9947015.html
Copyright © 2011-2022 走看看