小编Tim*_*son的帖子

从 C# 使用 C++/WinRT 组件

我有一个用 C++/CX 编写的项目(动态库),该项目由用 C# 编写的 Windows 10 通用应用程序(针对 x86 和 ARM32)使用。
我想将库重写为C++/WinRT,以便使用普通 C++。

问题 1:是否可以创建 C++/WinRT DLL 并从 C# 中使用它?
问题 2:如何设置 C++/WinRT 项目以使其能够从商店应用程序中使用?

c# windows-runtime c++-cx winrt-component c++-winrt

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

实体框架 - 删除带有外键的对象,保留父对象

我有以下型号:

public class Company
{
    //Primary key
    public string ID { get; set; } 

    //Foreign key
    public int? LogotypeID { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

public class Logotype
{
    //Primary key
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int? ID { get; set; }

    //Foreign key
    public string CompanyID { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

如何从公司表中删除标识而不删除公司行?

使用:
http://msdn.microsoft.com/en-us/library/system.data.entity.dbset.remove (v=vs.113).aspx DbSet.Remove(Logotype) 会引发以下异常:

{"The DELETE statement conflicted with the REFERENCE constraint \"FK_dbo.Companies_dbo.Logotypes_LogotypeID\". The conflict occurred in database \"ShipReg\", table \"dbo.Companies\", column 'LogotypeID'.\r\nThe statement has been terminated."} …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework ef-code-first

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