Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 测试MobileServiceSQLiteStore时无法加载文件或程序集'SQLitePCL' 当单元测试访问MobileServiceSQLiteStore时,无法加载文件或程序集SQLitePCL_Android_Sqlite_Azure_Azure Mobile Services_Xamarin Studio - Fatal编程技术网

Android 测试MobileServiceSQLiteStore时无法加载文件或程序集'SQLitePCL' 当单元测试访问MobileServiceSQLiteStore时,无法加载文件或程序集SQLitePCL

Android 测试MobileServiceSQLiteStore时无法加载文件或程序集'SQLitePCL' 当单元测试访问MobileServiceSQLiteStore时,无法加载文件或程序集SQLitePCL,android,sqlite,azure,azure-mobile-services,xamarin-studio,Android,Sqlite,Azure,Azure Mobile Services,Xamarin Studio,我一直在尝试按照此处的Azure入门说明为移动应用程序构建我的第一个Microsoft Azure WebAPI );移动应用程序使用MobileServiceSQLiteStore类的离线同步(推、拉)。我的问题是,我一直得到无法加载…SQLitePCL错误。我花了整整两天的时间研究这个问题,读过很多类似的堆栈溢出问题,非常相似,但没有一个能帮助解决这个问题 我们的目标不仅仅是克服这个错误(以防有更实际的解决方法),而是能够编写集成(验收测试)和单元测试来测试我的代码,我将编写这些代码来包装

我一直在尝试按照此处的Azure入门说明为移动应用程序构建我的第一个Microsoft Azure WebAPI

);移动应用程序使用MobileServiceSQLiteStore类的离线同步(推、拉)。我的问题是,我一直得到
无法加载…SQLitePCL
错误。我花了整整两天的时间研究这个问题,读过很多类似的堆栈溢出问题,非常相似,但没有一个能帮助解决这个问题

我们的目标不仅仅是克服这个错误(以防有更实际的解决方法),而是能够编写集成(验收测试)和单元测试来测试我的代码,我将编写这些代码来包装MobileServiceSqlLiteStore类

无论我做什么,我都无法获得
db.DefineTable()
在windows控制台或在windows下运行的单元测试中工作。 当我运行以下代码时

public class Person
{
    public int ID { get; set; }

    [JsonProperty(PropertyName = "text")]
    public string FirstName { get; set; }

    [JsonProperty(PropertyName = "text")]
    public string LastName { get; set; }
}

[Test]
public void can_create_db_and_create_table()
{
    var filename = @"d:\test\testdb.db3";
    SQLitePCL.Batteries.Init();                // this excecutes -> raw.SetProvider((ISQLite3Provider) new SQLite3Provider_esqlite3());
    var db = new MobileServiceSQLiteStore(filename);
    db.DefineTable<Person>();
}
。。。但这与Adroid和MobileServiceSQLiteStore类提供的功能不兼容

如果我使用dot net Reflector反编译
MobileServiceSQLiteStore
类,我可以确认
MobileServiceSQLiteStore
似乎是
SQLitePCL
类的包装器。 如果我运行下面的单元测试,我会得到与尝试访问
MobileServiceSQLiteStore
类时相同的错误,这就是为什么我希望在不在Android内部/上运行时可以访问此类的原因

[Test]
public void show_MobileServiceSQLiteStore_gives_same_error_as_SQLLitePCL_which_it_wraps()
{

    var path = @"provedb2.db";
    using (var db = new  SQLitePCL.SQLiteConnection($"Data Source={path};Version=3;"))
    {
        var cmd = db.Prepare("create table customer (name, tel, add1, add2, id UNIQUE)");
        cmd.Step();
    }
    // this fails with Unable to load DLL 'sqlite3.dll' >>> aargh!            
}
拥有这样一个怪物神类却无法对其进行单元测试,或者在其周围创建一个安全的包装,这似乎很荒谬

p、 我的开发机器是一个干净的Windows7专业版,带有一个干净、新鲜和最新的VisualStudio2015,专门为这个项目提供

任何关于如何在windows上运行此课程的建议都将不胜感激!i、 e.如何克服“无法加载文件或程序集SQLitePCL”错误

提前谢谢大家

致以最良好的祝愿


Alan

Azure Mobile Apps SDK和工具仅在Windows 8或更高版本的开发环境中受支持。您可能可以在Windows 7上运行它的某些部分,但不幸的是,我们不支持或测试该配置

您已经安装了SQLitePCL.bundle_green包,但这不是我们使用的客户端SDK使用的包。这就是为什么软件包安装似乎可以工作,但客户端库实际上不能工作的原因


您可以在.NET 4.5控制台应用程序中运行一些客户端库单元测试,请参见

我创建了一个沙盒播放解决方案,其中有三个项目显示了问题,而单单元测试显示了问题。解决方案就在这里:您指出您下载了SQLite的WinRT版本,但您有Windows7。Windows 7没有预编译版本,只有更高版本的Windows。确保您使用的是正确的版本!Hi@AdrianHall是的,我同意,…据我所知,Win7或更早版本没有预编译版本。然而,sqlite-winrt-3130000.vsix似乎在我的机器上起了作用。它可能以其他方式工作,但我相信它来自于安装时没有警告或错误的vsix。命令行工具和C#测试代码都能完美地工作。Azure包装器库类不起作用,SQLite肯定没有问题,请参见上面的最后一个示例测试;那项测试通过了。(使用SQLite WinRT vsix)我当然可能错了。呜呜!(感谢您的快速回复)我将不得不使用Azure移动应用程序的
托管客户端为MobileServiceSQLiteStore类编写一个包装器,但这似乎是一种浪费,因为微软团队肯定已经有了这样一个类,他们在编写MobileServiceSQLiteStore(msss)时将其用于测试上课?我无法想象,每次有人对MSS进行更改时,他们都会在droid设备上进行测试?太慢了。我可以使用NUnit3 Android runner()运行完整的端到端测试。这是一种享受,但正如我一直提到的,它要求每次你想对物理或虚拟机设备运行测试时都要部署droid应用程序,几乎无法启动,…我觉得我刚刚中风了,这是一种非常缓慢的编码方式。通过马邮递方式发送TDD测试结果-DIf如果您想使用Windows 7(我们不支持),那么从ISyncTable开始—当您实例化SQLiteSyncTable时,您可以替换任何实现ISyncTable的内容。SQLiteSyncTable恰好使用SQLitePCL与SQLite数据库进行通信。其他同步技术也是可能的。@snowcode SDK repo拥有所有的单元测试,这些测试通常作为.NET 4.5上的控制台应用程序运行。还有一个在所有客户端平台上运行的测试运行程序。看,这正是我要找的!
[Test]
public void show_MobileServiceSQLiteStore_gives_same_error_as_SQLLitePCL_which_it_wraps()
{

    var path = @"provedb2.db";
    using (var db = new  SQLitePCL.SQLiteConnection($"Data Source={path};Version=3;"))
    {
        var cmd = db.Prepare("create table customer (name, tel, add1, add2, id UNIQUE)");
        cmd.Step();
    }
    // this fails with Unable to load DLL 'sqlite3.dll' >>> aargh!            
}