• 简述跨域的mvc--还有数据库的迁移


      

    连接字符串 建实体数据模型name同名

    CodeFirst 数据库迁移(代码生成数据库)数据库迁移
    1.enable-migrations --启用数据库迁移
    2.add-migration -- 添加数据库迁移
    3.update-database  --更新数据库
    --------------------------4.ADD-MIGRATION +版本号  --添加迁移 add-migration
    -------------------5.update-database  --更新数据库

    覆盖 enable-migrations -force

    <connectionStrings>

    <add name="Model1" connectionString="data source=.;initial catalog=RKJN;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />

    </connectionStrings>

     
     
    建库image/1.png图片格式
    定义模型层
    然后dal显示方法
    拉DB
    public List<ChanPinModel> GetChanPin()
        
                    string sql = "";
                    return LogHelper.GetShows<ChanPinModel>(sql);
            
    控制器写方法
            //产品表的获取
            [HttpGet]
            [Route("api/ChanPin")]
            public List<ChanPinModel> GetChanPin()
            {
                return dal.GetChanPin();
            }
    跨域文件。连接数据库(写连接字符串)
     </handlers>
    跨域文件
      </system.webServer>
      </appSettings>
    <connectionStrings>
        <add name="con" connectionString=""/>
      </connectionStrings>
      <system.web>
    运行得到路径api/控制器/方法名

    到mvc
    建方法生成视图  拉<script src="~/Scripts/jquery-3.3.1.js"></script>
  • 相关阅读:
    RequestMapping_PathVariable注解
    RequestMapping_Ant 路径
    RequestMapping_请求参数&请求头
    RequestMapping_请求方式
    RequestMapping注解_修饰类
    18)C++对C的增强
    17)C++开始--命名空间
    16)未理解透
    15)文件函数例子
    14)文件操作
  • 原文地址:https://www.cnblogs.com/gc1229/p/13275998.html
Copyright © 2020-2023  润新知