开发者

What's a simple/lightweight way to persist objects in .net during development and experimentation?

开发者 https://www.devze.com 2023-03-07 14:10 出处:网络
I\'m lookin开发者_C百科g for a simple way to persist objects when experimenting and creating mock UIs or services.I already know what ORM I\'ll ultimately use later on when producing a releasable prod

I'm lookin开发者_C百科g for a simple way to persist objects when experimenting and creating mock UIs or services. I already know what ORM I'll ultimately use later on when producing a releasable product but I don't want to bother setting it all up at this stage.

I'm looking for something that:

  • has low install requirements (ideally, single dll)
  • has low setup requirements (no column definitions, no XML mappings, no table creation..)
  • has low performance (really just needs to support 1 or 2 concurrent users)
  • persists data across application restarts

What I really want, is something like a hashtable that survives application restarts.

What tools would you see appropriate for this? What approaches do you take when you want to persist simple data structures without any muss?


You could just use the framework's built-in Serialization Support.

In terms of your requirements:

  • No install requirements (in framework already)
  • No setup requirements (provided types are serializable)
  • Performance is not as good as most ORMs, but still works.
  • Can persist data to files, or any other source that can take a Stream


well will tricky to tick all these boxes.

I have used SQLite in the past, was quite to mock DBs.

As it comes to persistance, you can try to use native Xml Serialization/JSON or Google's ProtoBuffers.

It is better if you have your Domain Model for your data, that way you can easily Desereliaze/Restore from underlying data (be in simple dump file/xml/db).

that way you will alwyas work with Domain Model and not the underlying data. you can change your underlaying data later on but your Domain Model stays the same

0

精彩评论

暂无评论...
验证码 换一张
取 消