Insert/Select with Linq-To-SQL

前端 未结 2 948
借酒劲吻你
借酒劲吻你 2020-12-20 17:49

Is there a way to do an insert/select with Linq that translates to this sql:

INSERT INTO TableA (...)
SELECT ...
FROM TableB
WHERE ...
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-20 17:54

    context
      .TableA
      .InsertAllOnSubmit(
        context
          .TableB
          .Where( ... )
          .Select(b => new A { ... })
      );
    

提交回复
热议问题