代码之家  ›  专栏  ›  技术社区  ›  Max

SQL到具有继承的实体

  •  1
  • Max  · 技术社区  · 14 年前

    ctx.CreateQuery<InheritedEntity>() 
    

    它获取所有类,而不仅仅是继承类。

    我尝试引用SQL中的继承类:

    "SELECT Value p FROM InheritedEntity as p"
    

    但它不起作用。

    "... WHERE RecordType = ..."
    

    但它不起作用。

    我在MSDN里也找不到任何东西。

    编辑:

     ctx.CreateQuery<BaseEntity>(sqlText).OfType<InheritedEntity>()
    

    现在我想知道这是不是最好的办法。

    1 回复  |  直到 14 年前
        1
  •  2
  •   Max    14 年前
    ctx.CreateQuery<BaseEntity>(sqlText).OfType<InheritedEntity>()