小编O'R*_*ney的帖子

如何完全重置所有Entity Framework 6迁移历史记录?(僵尸迁移!)

精简版:

删除整个数据库(包括__MigrationHistory)和解决方案中的所有迁移...不知何故,命名迁移正在某处找到并由DbMigrator应用!他们来自哪里???

长版:

我们正在使用Entity Framework 6,针对SQL Server 2012.它是一个MVC webapp,我们正在使用基于代码的迁移,此时我们有一个适度的迁移历史.我们在启动时运行迁移:

public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        ...

        var configuration = new Configuration();
        var migrator = new DbMigrator(configuration);
        migrator.Update();
    }
}
Run Code Online (Sandbox Code Playgroud)

在几台PC上它工作正常,但在一台 PC上,我遇到了一些问题,它们在某些方面似乎不同步.每当应用程序运行时,它都会抱怨有待更改.

System.Data.Entity.Migrations.Infrastructure.AutomaticMigrationsDisabledException occurred
HResult=-2146233088
Message=Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration. …
Run Code Online (Sandbox Code Playgroud)

.net ef-migrations entity-framework-6

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

Android Pie:WebView在某些站点上显示纯HTTP错误,即使使用useClearTextTraffic =“ true”

我们的android应用程序中有一个WebView,最终用户可以浏览到他们想要的任何站点。Android Pie默认情况下禁用纯HTTP,因此我们在清单中添加了useClearTextTraffic =“ true”。

这适用于某些网站,但不适用于google.com等其他网站!在不起作用的站点上,我们仍然会得到net :: ERR_CLEARTEXT_NOT_PERMITTED,好像我们没有设置清单设置一样。

webview HTTP错误的屏幕截图

我认为这可能与HSTS有关,但在那种情况下,我只希望WebView立即重定向到HTTPS。

因此问题是,即使清单中的useClearTextTraffic已打开,为什么Android WebView仍然无法通过纯HTTP浏览某些站点?

(PS我们没有网络安全配置)

我们正在Google Pixel 1XL上进行测试。

普通的HTTP不起作用:

普通的http工作:

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.umajin.umajinviewer">

    <permission android:name="com.umajin.umajinviewer.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.umajin.umajinviewer.permission.C2D_MESSAGE" />

    <application android:label="Umajin Preview"
                 android:icon="@mipmap/ic_launcher"
                 android:theme="@android:style/Theme.NoTitleBar">
        <activity android:name="Umajin"
                  android:label="Umajin Preview"
                  android:configChanges="orientation|screenSize|keyboardHidden"
                  android:screenOrientation="fullSensor"
                  android:icon="@mipmap/ic_launcher"
                  android:largeHeap="true"
                  android:windowSoftInputMode="stateHidden|adjustPan"
                  android:launchMode="singleTask"
                  android:usesCleartextTraffic="true"
                  >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.nfc.action.TAG_DISCOVERED"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>
            <intent-filter> …
Run Code Online (Sandbox Code Playgroud)

android http webview

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

是什么原因导致 iOS 权限提示“使用蓝牙进行新连接”?

从 iOS13 开始,我们使用 BLE 信标进行定位的应用程序现在会收到两个与蓝牙相关的权限提示。

第一个是可以理解和预期的:

提示使用蓝牙

第二个提示不是预期的,我们也不知道为什么会发生。

提示“使用蓝牙进行新连接”

仅供参考,该应用程序当前是使用以前的 iOS SDK/XCode 编译的。

permissions bluetooth ios

6
推荐指数
1
解决办法
3522
查看次数

MVC/Razor引擎如何从模型中查找视图?

鉴于我们有一个控制器方法只返回一个模型对象的ViewResult,MVC或Razor引擎如何继续查找要使用的View,只给出ViewResult?例如

    public ActionResult Index()
    {
        return View( db.Persons.ToList());
    }
Run Code Online (Sandbox Code Playgroud)

编辑:换句话说,一旦这个方法返回所有引擎必须继续是一个ViewResult.用于查找视图的任何内容都必须存储在此ViewResult中.

它是否使用cshtml文件顶部的绑定?

    @model IEnumerable<Database.Models.Person>
Run Code Online (Sandbox Code Playgroud)

或者它是否使用模型类的字符串名称并通过路由查找?

或者它实际上是否记得哪个控制器称为View()方法,并以此为基础?

或者是其他东西?

对不起,如果这是一个明显的问题.我已经阅读了很多Stackoverflow问题和其他页面,但无法找到使用的方法......我看到很多关于URL如何映射到控制器的讨论,但这不是我感兴趣的部分.

asp.net-mvc razor

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