private void FilterDescValueToCompare(out FilterKey fk, out FilterKey fk1)
		{
			const string filterName = "DescriptionEqualAndValueGT";
			var f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pDesc", "something").SetParameter("pValue", 10);
			fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);

			var f1 = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f1.SetParameter("pDesc", "something").SetParameter("pValue", 11);
			fk1 = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
		}
		private void FilterDescLikeToCompare(out FilterKey fk, out FilterKey fk1)
		{
			const string filterName = "DescriptionLike";
			var f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pLike", "so%");
			fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);

			var f1 = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f1.SetParameter("pLike", "%ing");
			fk1 = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
		}
		public static ISet CreateFilterKeys(IDictionary<string, IFilter> enabledFilters, EntityMode entityMode)
		{
			if (enabledFilters.Count == 0)
				return null;
			Set result = new HashedSet();
			foreach (FilterImpl filter in enabledFilters.Values)
			{
				FilterKey key = new FilterKey(filter.Name, filter.Parameters, filter.FilterDefinition.ParameterTypes, entityMode);
				result.Add(key);
			}
			return result;
		}
		public void ToStringIncludeAll()
		{
			string filterName = "DescriptionLike";
			var f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pLike", "so%");
			var fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
			Assert.That(fk.ToString(), Is.EqualTo("FilterKey[DescriptionLike{'pLike'='so%'}]"));

			filterName = "DescriptionEqualAndValueGT";
			f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pDesc", "something").SetParameter("pValue", 10);
			fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
			Assert.That(fk.ToString(), Is.EqualTo("FilterKey[DescriptionEqualAndValueGT{'pDesc'='something', 'pValue'='10'}]"));
		}
		private void QueryKeyFilterDescLikeToCompare(out QueryKey qk, out QueryKey qk1)
		{
			const string filterName = "DescriptionLike";
			var f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pLike", "so%");
			var fk =  new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
			ISet<FilterKey> fks = new HashSet<FilterKey> { fk };
			qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks);

			var f1 = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f1.SetParameter("pLike", "%ing");
			var fk1 = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
			fks = new HashSet<FilterKey> { fk1 };
			qk1 = new QueryKey(sessions, SqlAll, new QueryParameters(), fks);
		}
Пример #6
0
        public static ISet CreateFilterKeys(IDictionary <string, IFilter> enabledFilters, EntityMode entityMode)
        {
            if (enabledFilters.Count == 0)
            {
                return(null);
            }
            Set result = new HashedSet();

            foreach (FilterImpl filter in enabledFilters.Values)
            {
                FilterKey key = new FilterKey(filter.Name, filter.Parameters, filter.FilterDefinition.ParameterTypes, entityMode);
                result.Add(key);
            }
            return(result);
        }
Пример #7
0
		private void QueryKeyFilterDescValueToCompare(out QueryKey qk, out QueryKey qk1)
		{
			const string filterName = "DescriptionEqualAndValueGT";

			var f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pDesc", "something").SetParameter("pValue", 10);
			var fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
			ISet<FilterKey> fks = new HashedSet<FilterKey> { fk };
			qk = new QueryKey(sessions, SqlAll, new QueryParameters(), (ISet)fks);

			var f1 = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f1.SetParameter("pDesc", "something").SetParameter("pValue", 11);
			var fk1 = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);
			fks = new HashedSet<FilterKey> { fk1 };
			qk1 = new QueryKey(sessions, SqlAll, new QueryParameters(), (ISet)fks);
		}
Пример #8
0
        public static ISet <FilterKey> CreateFilterKeys(IDictionary <string, IFilter> enabledFilters)
        {
            if (enabledFilters.Count == 0)
            {
                return(null);
            }

            var result = new HashSet <FilterKey>();

            foreach (FilterImpl filter in enabledFilters.Values)
            {
                var key = new FilterKey(filter);
                result.Add(key);
            }
            return(result);
        }
		public void ToStringWithMoreFilters()
		{
			string filterName = "DescriptionLike";
			var f = new FilterImpl(sessions.GetFilterDefinition(filterName));
			f.SetParameter("pLike", "so%");
			var fk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);

			filterName = "DescriptionEqualAndValueGT";
			var fv = new FilterImpl(sessions.GetFilterDefinition(filterName));
			fv.SetParameter("pDesc", "something").SetParameter("pValue", 10);
			var fvk = new FilterKey(filterName, f.Parameters, f.FilterDefinition.ParameterTypes, EntityMode.Poco);

			ISet<FilterKey> fks = new HashSet<FilterKey> { fk, fvk };
			var qk = new QueryKey(sessions, SqlAll, new QueryParameters(), fks);
			Assert.That(qk.ToString(), Is.StringContaining(string.Format("filters: ['{0}', '{1}']", fk, fvk)));
		}