public IEnumerable <Gnosis.ITag> GetByAlgorithm(IAlgorithm algorithm, TagDomain domain, string pattern)
        {
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }
            if (pattern == null)
            {
                throw new ArgumentNullException("pattern");
            }

            try
            {
                logger.Info("SQLiteTagRepository.GetByAlgorithm(IAlgorithm, TagDomain, string)");

                var builder = new CommandBuilder("select * from Tag where Algorithm = @Algorithm and Domain = @Domain and Value like @Pattern;");
                builder.AddParameter("@Algorithm", algorithm.Id);
                builder.AddParameter("@Domain", (int)domain);
                builder.AddParameter("@Pattern", pattern);

                return(GetTags(builder));
            }
            catch (Exception ex)
            {
                logger.Error("  GetByAlgorithm(IAlgorithm, TagDomain, string)", ex);
                throw;
            }
        }
예제 #2
0
 private TagType(int id, string name, string code, TagDomain domain)
 {
     if (name == null)
         throw new ArgumentNullException("name");
     
     this.id = id;
     this.name = name;
     this.code = code;
     this.domain = domain;
 }
예제 #3
0
        private TagType(int id, string name, string code, TagDomain domain)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            this.id     = id;
            this.name   = name;
            this.code   = code;
            this.domain = domain;
        }
예제 #4
0
        private ICommandBuilder GetSelectByTagBuilder <T>(TagDomain domain, string pattern, IAlgorithm algorithm)
            where T : class, IMetadata
        {
            var tableName = GetTableName <T>();

            var builder = new CommandBuilder();

            builder.AppendFormatLine("select {0}.* from {0} inner join Tag on {0}.Location = Tag.Target where Tag.Algorithm = @Algorithm and Tag.Domain = @Domain and Tag.Value like @Pattern;", tableName);
            builder.AddParameter("@Algorithm", algorithm.Id);
            builder.AddParameter("@Domain", (int)domain);
            builder.AddParameter("@Pattern", pattern);
            return(builder);
        }
        public IEnumerable <Gnosis.ITag> GetByTarget(Uri target, TagDomain domain)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            try
            {
                logger.Info("SQLiteTagRepository.GetByTarget(Uri, TagDomain)");

                var builder = new CommandBuilder("select * Tag where Target = @Target and Domain = @Domain;");
                builder.AddParameter("@Target", target.ToString());
                builder.AddParameter("@Domain", (int)domain);

                return(GetTags(builder));
            }
            catch (Exception ex)
            {
                logger.Error("  GetByTarget(Uri, TagDomain)", ex);
                throw;
            }
        }
예제 #6
0
        public IEnumerable <T> GetByTag <T>(TagDomain domain, string pattern, IAlgorithm algorithm)
            where T : class, IMetadata
        {
            if (pattern == null)
            {
                throw new ArgumentNullException("pattern");
            }
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }

            try
            {
                var builder = GetSelectByTagBuilder <T>(domain, pattern, algorithm);

                return(GetItems <T>(builder));
            }
            catch (Exception ex)
            {
                logger.Error("  SQLiteMediaItemRepository.GetByTarget", ex);
                throw;
            }
        }
예제 #7
0
 public IEnumerable <T> GetByTag <T>(TagDomain domain, string pattern)
     where T : class, IMetadata
 {
     return(GetByTag <T>(domain, pattern, Algorithms.Algorithm.Default));
 }
        public IEnumerable<Gnosis.ITag> GetByAlgorithm(IAlgorithm algorithm, TagDomain domain, string pattern)
        {
            if (algorithm == null)
                throw new ArgumentNullException("algorithm");
            if (pattern == null)
                throw new ArgumentNullException("pattern");

            try
            {
                logger.Info("SQLiteTagRepository.GetByAlgorithm(IAlgorithm, TagDomain, string)");

                var builder = new CommandBuilder("select * from Tag where Algorithm = @Algorithm and Domain = @Domain and Value like @Pattern;");
                builder.AddParameter("@Algorithm", algorithm.Id);
                builder.AddParameter("@Domain", (int)domain);
                builder.AddParameter("@Pattern", pattern);

                return GetTags(builder);
            }
            catch (Exception ex)
            {
                logger.Error("  GetByAlgorithm(IAlgorithm, TagDomain, string)", ex);
                throw;
            }
        }
        public IEnumerable<Gnosis.ITag> GetByTarget(Uri target, TagDomain domain)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            try
            {
                logger.Info("SQLiteTagRepository.GetByTarget(Uri, TagDomain)");

                var builder = new CommandBuilder("select * Tag where Target = @Target and Domain = @Domain;");
                builder.AddParameter("@Target", target.ToString());
                builder.AddParameter("@Domain", (int)domain);

                return GetTags(builder);
            }
            catch (Exception ex)
            {
                logger.Error("  GetByTarget(Uri, TagDomain)", ex);
                throw;
            }
        }