Esempio n. 1
0
        public void HbmCustomizer_ShouldChangePropertyAttribute()
        {
            ClassInfo clazz    = TestUtils.ParseHbm("Agency.hbm.xml", "Agency", ClassType.JoinedSubClass);
            Property  nameProp = clazz.GetAndAssertProperty("Name");

            var customizer = new HbmCustomizer();

            customizer.Register(LimitLengthOfName);
            customizer.Customize(clazz);

            nameProp.Should()
            .HaveName("OwnName")
            .HaveAttribute("length", "30")
            .HaveAttribute("column", "Name");
        }
Esempio n. 2
0
        private HbmCustomizer GetHbmCustomizer()
        {
            var customizer = new HbmCustomizer();

            customizer.Register(LimitNameLength);
            return(customizer);

            void LimitNameLength(Property property)
            {
                if (property.Name == "Name")
                {
                    property.AddDefault("length", "30");
                }
            }
        }