Пример #1
0
            public void Set(ProviderSettingsType type, double value)
            {
                var doc = new BsonDocument {
                    ["_id"]   = (int)type,
                    ["value"] = value
                };

                _collection.Upsert(doc);
            }
Пример #2
0
            public decimal GetAsDecimal(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsDecimal : default(decimal));
            }
Пример #3
0
            public byte[] GetAsBinary(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsBinary : default(byte[]));
            }
Пример #4
0
            public DateTime GetAsDateTime(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsDateTime : default(DateTime));
            }
Пример #5
0
            public bool GetAsBoolean(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null && data["value"].AsBoolean);
            }
Пример #6
0
            public string GetAsString(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsString : default(string));
            }
Пример #7
0
            public long GetAsInt64(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsInt64 : default(long));
            }
Пример #8
0
            public int GetAsInt32(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsInt32 : default(int));
            }
Пример #9
0
            public Guid GetAsGuid(ProviderSettingsType type)
            {
                var data = _collection.FindById((int)type);

                return(data != null ? data["value"].AsGuid : default(Guid));
            }