There is a class. I serialize it through BinaryFormatter
in a FileStream
. Now the question is, is it possible to use this class directly from a file without deserializing it entirely into memory (well, for example, the class weighs 4 GB, agree that it is expensive)?
UPD:
and how did you imagine it without deserialization? Binary serialization does not provide for partial parsing and reading at all, it is not for that. For complex cases, ORM and different classes with a bunch of fields and lazy loading are usually used.
Will it allow me to work with an object of the type MyClass
?
To be honest, I have little idea.
There is a way to "unbox" from memory, but you still need to think about how to load an object into memory (more precisely, calculate where it is in memory) ... do you mean this? How in with (with ++) what to load bytes into structure?
I don't need to load an object into memory. Only the member that I request should be loaded into memory for transmission.
4 Gb is not a DBMS by accident))) In the case of large objects, they use Memo Mapping, but in this case the object is beaten on the pages and works with the page.
Technically, this is not a DBMS. In fact, it is a huge data set stored in an instance of a class. I really do not want to write all this in a relational database, but I am not familiar with others. It will be very difficult to translate the class schema into the database schema. More precisely, not that it would be difficult, they just will be very different, which means that when expanding the functionality, you will have to solve many compatibility problems, instead of going headlong into logic. I do not like to alter the scheme. If it is one - this is normal, but when another appears, connected with the first one, but with differing possibilities, a headache begins.
UPD2:
Something like this looks like a class (I can’t provide a literal code, but the meaning will be clear, I think):
[Serializable] public class MyClass { List<MyClass2> List<MyClass3> List<MyClass4> ... } [Serializable] public class MyClass2 { public string Prop1 { get; set; } public int Prop2 { get; set; } public MyClass3 Prop3 { get; set; } ... } ...