관리 메뉴

IT 컴퓨터공학 자료실

Persistent Storage에 대해 본문

etc.. 기타 카테고리 2/영어 번역 & 일본어 번역

Persistent Storage에 대해

윤맨1 2015. 7. 19. 15:11

It is often necessary to store the value of the fields of an object to disk and then, later, retrieve this data. Although this is easy to achieve without relying on serialization, this approach is often cumbersome and error prone, and becomes progressively more complex when you need to track a hierarchy of objects. Imagine writing a large business application, that contains thousands of objects, and having to write code to save and restore the fields and properties to and from disk for each object. Serialization provides a convenient mechanism for achieving this objective.

 

디스크에 객체의 value를 저장하거나 불러올 때 필요한 것이다. serialization에 의존 없이 쉽게 value를 얻을 수 있지만, 프로그램의 오브젝트가 수천 개처럼 많아지는 경우에는 다루기 어려워지고, 에러가 종종 나는 경우가 있다. 일일이 하나하나 코드를 작성하여 디스크에 쓰고 불러와야 하기 때문이다. 이와 반대로 Serialization은 오브젝트를 불러오기엔 편한 메커니즘을 가지고 있다.

 

The common language runtime manages how objects are stored in memory and provides an automated serialization mechanism by using reflection. When an object is serialized, the name of the class, the assembly, and all the data members of the class instance are written to storage. Objects often store references to other instances in member variables. When the class is serialized, the serialization engine tracks referenced objects, already serialized, to ensure that the same object is not serialized more than once. The serialization architecture provided with the .NET Framework correctly handles object graphs and circular references automatically. The only requirement placed on object graphs is that all objects, referenced by the serialized object, must also be marked as Serializable (for more information, see Basic Serialization). If this is not done, an exception will be thrown when the serializer attempts to serialize the unmarked object.

When the serialized class is deserialized, the class is recreated and the values of all the data members are automatically restored.

 

일반적으로 오브젝트를 메모리에 저장하고, serialization을 이용하여 자동적으로 만들 때에는 리플렉션을 사용한다. 오브젝트가 serializate 되면 클래스나 오브젝트, 인스턴스가 모두 메모리에 저장된다. 오브젝트는 종종 멤버변수 안의 다른 인스턴스를 참조한다. 클래스가 serialization될 때 serialization engine은 오브젝트들을 참조한다



출처 : https://msdn.microsoft.com/en-us/library/yz07hhw9(v=vs.110).aspx