Esempio n. 1
0
        public void Initialize(IPluginHostAPI pluginHost)
        {
            var db        = pluginHost.GetRawDatabase();
            var jwtSecret = pluginHost.GetSettings(this)["JWTSecret"];

            pluginHost.ProvideAuth(new DefaultAuthProvider(db, jwtSecret, pluginHost.GetServerID()));
        }
Esempio n. 2
0
        public void Initialize(IPluginHostAPI pluginHost)
        {
            var tm = new TestModel();

            tm.ABC = "qweqowie";
            var db = pluginHost.GetRawDatabase();

            db.GetCollection <TestModel>("test_model").InsertOne(tm);
            Log.Debug("successfully inserted the model");
            var filter = Builders <TestModel> .Filter.Eq("ABC", "qweqowie");

            var found = db.GetCollection <TestModel>("test_model").Find(filter).FirstOrDefault();

            if (found != null)
            {
                Log.Debug($"Found document with ABC property: {found.ABC}");
            }
            else
            {
                Log.Debug("Nothing found!");
            }
        }