小编Yab*_*bie的帖子

实体框架6 Create()vs new

以这两种方式添加实体有什么区别?

MyEntity me = new MyEntity();
entities.myentities.Add(me);
Run Code Online (Sandbox Code Playgroud)

VS

MyEntity me = entities.myentities.Create();
Run Code Online (Sandbox Code Playgroud)

我还需要在第二个例子中添加"我"吗?如果是这样,是否有某种优势,无论如何?

非常感谢!

c# entity-framework-6

15
推荐指数
2
解决办法
5752
查看次数

适用于 C# .NET 的蓝牙低功耗 (BLE) API - 桌面应用程序 Windows 10

我正在尝试编写一个桌面应用程序来访问低功耗蓝牙 (BLE) 设备。

我的目标平台是 Windows 10,我使用的是 Visual Studio Community 2015、.NET 4.6.1。

似乎没有包含用于访问 BLE 设备的 API。我找到了32feet,但只支持普通蓝牙。

我看过一些关于使用 Windows UWP 库和/或 WinRT 库的帖子,但这似乎有点像黑客。

现在肯定有一种与 BLE 设备交互的“好”方式吗?

一如既往的TIA。

bluetooth-lowenergy windows-10-desktop

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

无法确定类型为“System.Data.Sqlite.SqliteFactory”的提供者工厂的提供者名称

生成模型时发生意外异常。有关更多详细信息,请参阅输出窗口。异常消息:“NotSupportedException:无法确定类型为“System.Data.SQLite.SQLiteFactory”的提供程序工厂的提供程序名称。确保在应用程序配置中安装或注册了 ADO.NET 提供程序。

当我尝试简单地刷新我的模型(在我的 edmx 文件的设计器中)时,会发生上述错误。我有一个我创建的数据库,但是当我第一次遇到这个异常时,我试图添加一个表。现在,简单地刷新模型会导致异常。据我所知,我没有修改任何其他内容。

我已经用谷歌搜索了这个地狱,但我已经无能为力了。

我正在使用 VS2017、EF6 和 SQLite(我认为是 v3)。

这是我的 App.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
  </startup>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"/>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite …
Run Code Online (Sandbox Code Playgroud)

c# sqlite entity-framework entity-framework-6

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

-目录开关并非始终在Powershell中工作

一起屠杀Powershell脚本,我似乎与dir(Get-ChildItem cmdlet)的-Directory开关的行为不一致。

如果我运行常规的Powershell实例并输入dir -Directory,那么它将正常工作。

但是,当我将其放在.ps1文件中并运行它时,我得到了:

Get-ChildItem : A parameter cannot be found that matches parameter name 'Directory'.

是什么赋予了?

我在带有Powershell 5.1的Windows 10上

powershell

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