小编Tom*_*Tom的帖子

无法创建类型为“[DBContext 的名称]”的对象。对于设计时支持的不同模式

我正在 Udemy 中学习有关 ASP.NET MVC 的 Mosh Hamedani 课程之一。

我在使用代码优先(实体框架)设计数据库时遇到了一个错误。

起初,我收到了“在程序集中找不到 DbContext”的错误消息。解决了这个问题后,又一个突然冒出来了。

下图将显示添加迁移时发现的错误。我已经搜索了相同的错误,但没有找到。我在过去的两个小时里一直在挣扎,但到目前为止还没有解决任何问题。

请有人帮助我。谢谢

无法创建“Vidly_Context”类型的对象。有关设计时支持的不同模式,请参阅https://go.microsoft.com/fwlink/?linkid=851728


使用 (2) 参数添加自己的 DbContext 构造函数后出现类似问题。应用程序正常,但迁移停止工作。通过使用来自Dotnet 工具 @xspdf 的信息并通过方法 + 硬编码默认连接字符串(如果未设置)替换提到的构造函数,通过第一次更新 EF(使用 5 时出于奇怪原因使用 3.1.5)来修复

dotnet tool update --global dotnet-ef

// following command show the most during migration build/run in cmd
// mind current dir is Migrations folder of (VS) startup project here
dotnet ef --startup-project ../ --verbose migrations add test
Run Code Online (Sandbox Code Playgroud)

3.1.5 & 上下文激活错误

The Entity Framework …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc entity-framework entity-framework-core entity-framework-migrations

56
推荐指数
9
解决办法
6万
查看次数

Javascript为什么要在IIFE中包装变量或构造函数?

我今天看到了这样的事情

var Visualizer = (function() {
    function Visualizer() {
    //...
    }
    Visualizer.prototype.function1 = function () { /* ... */ }
    //...
    return Visualizer;
})();

var viz = new Visualizer();
Run Code Online (Sandbox Code Playgroud)

我不明白这一点与仅仅摆脱了生命包装.

javascript iife

7
推荐指数
1
解决办法
1844
查看次数

尝试加载一些数据

我试图了解如何运行一些代码。我想用 JSON 文件中的数据绘制圆圈。我不太确定如何解决这个问题。我想我搞砸了没有连接文件,或者我的 JSON 文件设置不正确......我的最终目标是制作一个连接的散点图,所以现在,我只关注圆圈。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<svg id="s" xmlns="http://www.w3.org/2000/svg" />
<script type="text/javascript">
  function makeSVG(tag, attrs) {
    var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
    for (var k in attrs)
      el.setAttribute(k, attrs[k]);
    return el;
  }

  var data;
  $.getJSON("https://raw.githubusercontent.com/Nataliemcg18/Data/master/temp.json", function(data) {
    draw(data);
  });

  var circle = makeSVG('circle', {
    cx: 100,
    cy: 50,
    r: 40,
    stroke: 'black',
    'stroke-width': 2,
    fill: 'red'
  });
  var data
  document.getElementById('s').appendChild(circle);
</script>

<svg width="1000" height="1000">
        <line x1="200" y1="100" x2="200" y2="600" height="1000" width="1000" style="stroke:black;stroke-width:2"  /> 
        <line x1="200" y1="600" x2="900" y2="600" height="1000" width="1000" …
Run Code Online (Sandbox Code Playgroud)

html javascript svg json

5
推荐指数
1
解决办法
84
查看次数