Пример #1
0
        FilterDefinitionMapping IFilterDefinition.GetFilterMapping()
        {
            var mapping = new FilterDefinitionMapping();

            mapping.Set(x => x.Name, Layer.Defaults, filterName);
            mapping.Set(x => x.Condition, Layer.Defaults, filterCondition);
            foreach (var pair in Parameters)
            {
                mapping.Parameters.Add(pair);
            }
            return(mapping);
        }
        public void ShouldWriteTheFilterDefinitions()
        {
            var filterDefinition = new FilterDefinitionMapping();

            filterDefinition.Set(x => x.Name, Layer.Defaults, "sid");
            filterDefinition.Parameters.Add("george", NHibernateUtil.Int32);

            var writer = new XmlFilterDefinitionWriter();

            writer.VerifyXml(filterDefinition)
            .RootElement.HasName("filter-def")
            .HasAttribute("name", "sid")
            .Element("filter-param")
            .HasAttribute("name", "george")
            .HasAttribute("type", "Int32");
        }