private void GetView(string viewPath)
        {
            var query = @"SELECT Content, LastModified FROM [dbo].[Templates] WHERE Name = @Name;
                          UPDATE [dbo].[Templates] SET LastRequested = GetUtcDate() WHERE Name = @Name";

            using (var conn = _connectionFactory.GetNamedConnection("Client"))
            {
                _template    = conn.Query <StoredTemplate>(query, new { Name = viewPath }).FirstOrDefault();
                _viewContent = Encoding.UTF8.GetBytes(_template.Content);
            }
        }
Exemple #2
0
        public IDirectoryContents GetDirectoryContents(string subpath)
        {
            using (var connection = _connectionFactory.GetNamedConnection("Client"))
            {
                var path = new TemplatePathContext()
                {
                    Exists = true
                };

                var items = connection.Query <TemplateContext>("SELECT * FROM [dbo].[Templates] WHERE Name LIKE @Path",
                                                               new { Path = subpath + "%" }).ToList();
                if (items.Any())
                {
                    path.AddRange(items);
                }
                return(path);
            }
        }