使用标准方法升级我的数据库需要7秒,这太慢了,因为我的数据库有3个表,每个表有5个字段,几乎没有数据.
var configuration = new Configuration();
var migrator = new DbMigrator(configuration);
//Update database to latest migration
migrator.Update();
Run Code Online (Sandbox Code Playgroud)
使用Entity Framework 6.0.
每次启动我的应用程序时,此代码都会运行,这会影响我的性能.为什么这么慢?无论如何要加快速度?
这是我的app.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
Run Code Online (Sandbox Code Playgroud) c# sql-server-ce entity-framework-4 ef-code-first ef-migrations
我有两个项目,每个项目都有大量的代码库。我想运行一个工具来浏览每个项目中的所有文件,并显示项目中的哪些文件具有相似的代码。我什至不确定是否存在这样的东西,但我记得在学校时,老师们有一个工具,他们在多个学生的所有代码上运行,以识别他们的代码有多相似(以抓住作弊者)。
我试图找出Windows 10虚拟触摸键盘是否可见,以确定是否从我的应用程序打开它.以下代码已经工作正常,直到最新的Windows 10更新15063或可能在它之前.好像微软改变了窗口样式的东西,但我无法弄明白.
public static bool IsKeyboardVisible()
{
IntPtr keyboardHandle = GetKeyboardWindowHandle();
// Specifies we wish to retrieve window styles.
int GWL_STYLE = -16;
//The window is disabled. See http://msdn.microsoft.com/en-gb/library/windows/desktop/ms632600(v=vs.85).aspx.
UInt32 WS_VISIBLE = 0x10000000;
UInt32 WS_DISABLED = 0x08000000;
UInt32 WS_POPUP = 0x80000000;
bool visible = false;
bool disabled = false;
if (keyboardHandle != IntPtr.Zero)
{
UInt32 style = GetWindowLong(keyboardHandle, GWL_STYLE);
visible = ((style & WS_VISIBLE) == WS_VISIBLE);
disabled = ((style & WS_DISABLED) == WS_DISABLED); // ref https://stackoverflow.com/questions/11065026/get-window-state-of-another-process
log.InfoFormat("style:{0:X4} visible:{1} disabled:{2}", …Run Code Online (Sandbox Code Playgroud)