EF 4 - 在UPDATE附加到字段

时间:2013-07-08 13:12:16

标签: asp.net-mvc-3 entity-framework-4

我正在尝试附加到某个字段,但是当我尝试以下操作时,现有数据(Update.Comments)会被followUpComments覆盖,而不是附加到它。

我如何追加?

    using (var context = new DBContext()){

        var Update = (from p in context.Prospects where p.id == recordIdToUpdate select p).Single();

        Update.Comments = Update.Comments + "\n\n" +followUpComments;

        context.SaveChanges();

    }

1 个答案:

答案 0 :(得分:0)

使用String.Concat而不是+ operator