zoukankan      html  css  js  c++  java
  • MVC4中使用EntityFramework

    首先,MVC4不支持EntityFramwok 6版本,如果安装了EntityFramwok 6,则vs不会自动引用dll和修改web.config配置。
    先删除旧的版本,执行指令:
    Uninstall-Package EntityFramework.zh-Hans
    Uninstall-Package EntityFramework  [-force]
    如:

     
    然后,
    通过NuGet安装EntityFramwok,可以指定要使用的版本,如(MVCEF1为项目名称):
    Install-Package EntityFramework -ProjectName MVCEF1 -Version 5.0

    执行成功后,web.config配置如下:
    <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    </configSections>
    ......
    <entityFramework>
    <contexts>
      <context type="MVCEF1.DAL.AccountContext,MVCEF1">
        <databaseInitializer type="MVCEF1.DAL.AccountInitializer,MVCEF1"></databaseInitializer>
      </context>
    </contexts>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    </entityFramework>


    参考:
    http://www.mamicode.com/info-detail-128217.html

  • 相关阅读:
    线性判别分析(LDA)
    奇异值分解(SVD)
    傅里叶变换
    SVM 之非线性支持向量机
    三角函数常用公式
    协方差、样本协方差和协方差矩阵
    方差和样本方差
    SVM 之线性支持向量机
    参考资料汇总
    QObject: Cannot create children for a parent that is in a different thread
  • 原文地址:https://www.cnblogs.com/zhaow/p/9754045.html
Copyright © 2011-2022 走看看