Esempio n. 1
0
        //LiteCollection<GeoLocation> locationCollection;
        //LiteCollection<TagArea> tagCollection;

        public TrainerDb(string path)
        {
            db = new LiteDatabase(path);
            mediaCollection = db.GetCollection <MediaDetails>("media");
            //locationCollection = db.GetCollection<GeoLocation>("locations");
            //tagCollection = db.GetCollection<TagArea>("tags");

            BsonMapper.Global.RegisterType <TagArea>
            (
                serialize: (tag) => tag.ToString(),
                deserialize: (bson) => TagArea.Parse(bson.AsString)
            );

            BsonMapper.Global.RegisterType <GeoLocation>
            (
                serialize: (loc) => loc.ToString(),
                deserialize: (bson) => GeoLocation.Parse(bson.AsString)
            );

            BsonMapper.Global.Entity <MediaDetails>()
            .Id(x => x.Id)
            .Ignore(x => x.FullPath)
            .Ignore(x => x.FullPreviewPath);
        }