开发者

Will LINQ to SQL Pick Up Trigger Changes/Errors?

I'm not very knowledgeable about the scope of certain SQL operations and how they relate to LINQ to SQL. If I have a trigger that updates a field in a record after it is inserted, what happens when I insert a new record using LINQ to SQL开发者_开发问答? So given this order of operations:

  1. Create new "MyObject" instance.
  2. Assign MyObject properties.
  3. Insert record using LINQ to SQL.
  4. SQL Insert Trigger Updates a property of that record to a new value.

Would step 5 be:

  1. "MyObject" holds the updated value.

    or

  2. "MyObject" holds the original value that I assigned to it.

And another question given the same steps 1-3:

4.. SQL Trigger throws an error and rolls back the Insert, similar to this example.

Would step 5 be:

  1. LINQ to SQL throws a SQL Exception.

    or

  2. ???


Answers: 2 and 1

But it's certainly worth testing as well because the exception may depend on connection string params.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜