Why are entity framework entities partial classes?

后端 未结 3 1371
不思量自难忘°
不思量自难忘° 2021-02-07 14:59

I recently began using entity framework, and I noticed that generated entities are partial classes. What are the uses of that? I googled a bit and people mostly speak of validat

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-07 15:44

    Marking it as partial allows you to put attributes to that class.
    It is handy for example when you need to mark DB generated class as Serializable to be able to store it in Session object (when SQL server mode is used in balanced environments).

提交回复
热议问题