小编Sve*_* M.的帖子

实体框架6.1代码优先级联使用TPH删除派生类型的一对一关系

我试图在公共基类和不相关的类的派生类之间创建2个一对一关系,这样当我删除父行时,数据库中的子行将被删除.我已经沉思了这个问题好几天了,我已经尝试了所有(对我来说)可以想象的流畅api中的关系组合.到目前为止没有令人满意的结果.这是我的设置:

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

 public int? DerivedTypeAID {get; set;}
 public virtual DerivedTypeA DerivedType {get; set;}

 public int? DerivedTypeBID {get; set;}
 public virtual DerivedTypeB DerivedType {get; set;}
}


public abstract class BaseType
{
  public int ID {get; set;}
  public string ClassName {get; set;}
  public virtual OtherType {get; set;}
}


public class DerivedTypeA : BaseType
{
 public string DerivedProperty {get; set;}
}

public class DerivedTypeB : BaseType
{
 public string DerivedProperty {get; set;}
}

public class …
Run Code Online (Sandbox Code Playgroud)

c# sql entity-framework code-first

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

在Visual Studio编辑器中按<ALT> + <ARROW_KEYS>写入单个ASCII字符

我使用VS2013作为我的IDE,自从我安装它以来,在按下ALT和任何箭头键时非常奇怪.我使用ALT + LEFT和ALT + RIGHT导航向前/向前导航,但是一旦VS完成跳转,它就会写出一个字符.

这是在跳跃之前:

在跳跃之前

这是在跳转后/按下ALT + LEFT之后: 跳后

这些是正在写的字符:

  • ALT + UP:◘
  • ALT +右:♠
  • ALT + DOWN:☻
  • ALT + LEFT:♦

我一直在使用VS2013工作,我以前从未见过这个.我知道按ALT + NUMPAD_KEYS产生ASCII字符,但为什么我的箭头键只发生在VS中呢?对我来说显然ALT + UP与按ALT + 6(http://www.irongeek.com/alt-numpad-ascii-key-combos-and-chart.html)相同.我实际上换掉了我的键盘,看看它是否与此有关.没有快乐.

有任何想法吗?

更新1:
看起来这个人有一个类似的问题,但在Windows上使用Eclipse:
https://superuser.com/questions/668394/turn-off-alt-numeric-keypad-ascii-symbol-insertion
可悲的是他的帖子没有答案.

更新2 /解决方案:

根据'Hans Passant'的评论,我找到了解决方案.请参阅下文了解详情.

ascii arrow-keys alt-key visual-studio-2013

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

os.path.join(p1,p2)省略了p1的斜杠

我是通勤时间的程序员所以请温柔.现在针对实际问题,我的一个用户正在遇到这种奇怪的行为,其中os.path.join(p1,p2)返回一个相对路径,其中省略了所有斜杠p1.像这样(假装这是在python cmd行解释器中完成的):

>>import os
>>p1 = "/Some/Path/Tosmth"
>>p2 = "file.ext"
>>print os.path.join(p1,p2)`
Run Code Online (Sandbox Code Playgroud)

然后输出是:

>>"SomePathTosmth/file.ext"
Run Code Online (Sandbox Code Playgroud)

就在加入操作之前,我检查了p1和p2的内容,这正是我所期待的.以下是一些其他调试代码的实际实现:

   def __moveMovie(self, src, dst, folder, file_name):
    try:
        self.logDebug('__moveMovie(): src=%s | dst=%s | folder=%s | file_name=%s' % (src, dst, folder, file_name))
        dest = save_path(dst)
        file_name = save_path(file_name)
        if self.getConfig("subfolder") is True:
            dest = os.path.join(dst,folder)
            os.mkdir(Utils().encode(dest))
    except OSError, e:
        if e.args[0] == 17:
            self.logDebug(u'Cannot create folder "%s". It already exists.' % os.path.join(dest))
    try:
        full_dst = Utils().encode(os.path.join(dest,file_name))
        self.logDebug('var "full_dst" w/o encode: %s' % os.path.join(dest, …
Run Code Online (Sandbox Code Playgroud)

python slash os.path

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