Esempio n. 1
0
        public void Update <T>(CatalogHolder <T> obj) where T : CatalogObjectBase
        {
            var sql         = "UPDATE catalog SET name = @name, content = @content WHERE id = @id";
            var catalogType = CatalogObjectExtensions.GetCatalogTypeFromAttribute <T>();
            var json        = JsonConvert.SerializeObject(obj.Content);
            var parameters  = new { id = obj.Id.ToString(), name = obj.Name, catalogType, content = json };

            _provider.ExecuteSqlite(sql, parameters);
        }
Esempio n. 2
0
        public void Add <T>(CatalogHolder <T> obj) where T : CatalogObjectBase
        {
            var sql =
                "INSERT INTO catalog (id, name, catalogType, content) VALUES (@id, @name, @catalogType, @content)";
            var catalogType = CatalogObjectExtensions.GetCatalogTypeFromAttribute <T>();
            var json        = JsonConvert.SerializeObject(obj.Content);
            var parameters  = new { id = obj.Id.ToString(), name = obj.Name, catalogType, content = json };

            _provider.ExecuteSqlite(sql, parameters);
        }