&是什么QUOT;数据视图没有标示在System.Data这&QUOT为可序列化;意思? [英] What does "DataView is not marked as serializable in System.data" mean?
问题描述
当我存储数据视图在ViewState中,.NET显示错误数据视图没有标记为System.Data这可序列化的,但是当我将它存储在会话,然后它完美?
背后是什么原因?其是未标记为其他对象
序列化?
When I store dataview in viewstate,.net shows the error "Dataview is not marked as serializable in system.data but when I store it in session, then it works perfectly? What is the reason behind it?? Which are the other objects that are not marked as "serializable " ?
推荐答案
这意味着该对象要存储(的数据视图)没有打上的 SerializableAttribute 。
It means that the object you want to store (DataView) isn't marked with a SerializableAttribute.
现在,你得到这个错误与ViewState的,而不是与会话的原因是因为ViewState是的总是的序列化,但是这并不一定会期如此。 在进程会话存储在服务器的内存中,并且不需要序列化。 SQLServer的会话必须序列存储在数据库中。
Now, the reason you're getting this error with ViewState and not with Session is because the ViewState is always serialized but that's not necessarily true of Session. In-Process sessions are stored in the server's memory and require no serialization. SQLServer sessions have to be serialized for storage in a database.
所以,任何时候你要存储在ViewState中的对象(或连载的会议),它必须被打上的 SerializableAttribute 。
So, anytime you want to store an object in the ViewState (or a serialized Session), it must be marked with a SerializableAttribute.
这篇关于&是什么QUOT;数据视图没有标示在System.Data这&QUOT为可序列化;意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!