LiteDB - .Net, IOS, Android, Windows Phone


참조 URL
  1. http://www.litedb.org/
  2. https://github.com/mbdavid/litedb
  3. https://github.com/Ar3sDevelopment/UnitOfWork.NET.LiteDB

 



 SQLite와 비슷하게 크로스 플랫폼을 지원하고 있지만 MongoDB에서 영감을 받아 만들어진 LiteDB다. MongoDB와 같이 json 또는 bson 형식으로 데이터를 관리한다.


아래 '코드1'은 "http://www.litedb.org/"에서 나와 있는 코드로 POCO 형식을 입출력하는 예제이며, '코드2'는 POCO 클래스와 실제 물리적인 테이블간의 매칭을 시켜주는 방법을 보여주고 있다.



[코드1] CRUD


[코드2] Mapping




LiteDB V2 ( 2.0.0 )은 아래와 같은 제한 사항과 기능을 가지고 있다.


제한 사항(Limits) : 


  • Collection Name:
    • Pattern: A-Z_-0-9
    • Maxlength of 30 chars
    • Case insensitive
  • Index Name:
    • Pattern: A-Z_-0-9 (. for nested document)
    • Maxlength of 30 chars
    • Case sensitive
  • BsonDocument Key Name:
    • A-Z_-0-9
    • Case sensitive
  • FileStorage FileId:
    • Pattern: same used in file system path/file.
    • Case sensitive
  • Collections: 3000 bytes to all collections names
  • Documents per collections: UInt.MaxValue
  • FileStorage Max File Length: 2Gb per file
  • Index key size: 512 bytes after BSON serialization
  • BSON document size: 1.044.224 bytes (~1Mb = 256 pages)
  • Nested Depth for BSON Documents: 20
  • Page Size: 4096 bytes
  • DataPage Reserved Bytes: 2039 bytes (like PCT FREE)
  • IndexPage Reserved Bytes: 100 bytes (like PCT FREE)
  • Database Max Length: In theory, UInt.MaxValue * PageSize (4096) = ~ Too big!




New features in v2 - https://github.com/mbdavid/LiteDB/releases

  • Portable version: LiteDB.Core (Supports UWP 8.1/10, Xaramin.iOS and Xaramin.Android)
  • Generic data access layer - can use any Stream or you can write your own disk access layer
  • Database encription option (using password= in connection string)
  • New memory cache manager (do not consume too memory in large inserts/updates)
  • Better mapping class from your entity to BsonDocument (like Configurations in EntityFramework)
  • Better cross reference with DbRef mapping (see unit tests examples)
  • Lazy engine load (open datafile only when run a command)
  • Reduce your database size with shrink()
  • Support for Initial Size and Limit Size database (connection string)
  • Complete re-write engine classes width full debug logger
  • Complete stats about data/index usage
  • Dump file to Import/Export your data using shell commands
  • Full documentation for v2 on Wiki
  • See more examples in http://www.litedb.org/










+ Recent posts