Ejemplo n.º 1
0
        public void update(SavableData received)
        {
            received.LastUpdate = DateTime.UtcNow;

            var data = new SavedDataDto <SavableData> {
                Data    = received,
                Uid     = received.Uid,
                Type    = received.GetType(),
                Updated = DateTime.UtcNow,
            };

            var serialized    = JsonConvert.SerializeObject(data);
            var serializedUid = JsonConvert.SerializeObject(data.Uid);

            var query = $"UPDATE {defaultTable} SET Data = '{serialized}' WHERE Uid = '{serializedUid}';";

            executeVoidQuery(query);
        }
Ejemplo n.º 2
0
        public void insert(SavableData received)
        {
            received.CreationDate = DateTime.UtcNow;
            received.LastUpdate   = DateTime.UtcNow;

            var data = new SavedDataDto <SavableData> {
                Data    = received,
                Uid     = received.Uid,
                Type    = received.GetType(),
                Updated = DateTime.UtcNow
            };

            var serialized    = JsonConvert.SerializeObject(data);
            var globalType    = JsonConvert.SerializeObject(received.GetType());
            var serializedUid = JsonConvert.SerializeObject(data.Uid);

            Console.WriteLine(globalType);

            var query = $"INSERT INTO {defaultTable} (Uid, Type, Data) VALUES ( '{serializedUid}', '{globalType}', '{serialized}');";

            executeVoidQuery(query);
        }