Esempio n. 1
0
        private bool HasExplicitTypeConvention(Member property)
        {
            // todo: clean this up!
            //        What it's doing is finding if there are any IUserType conventions
            //        that would be applied to this property, if there are then we should
            //        definitely automap it. The nasty part is that right now we don't have
            //        a model, so we're having to create a fake one so the convention will
            //        apply to it.
            var conventions = conventionFinder
                              .Find <IPropertyConvention>()
                              .Where(c =>
            {
                if (!typeof(IUserTypeConvention).IsAssignableFrom(c.GetType()))
                {
                    return(false);
                }

                var criteria   = new ConcreteAcceptanceCriteria <IPropertyInspector>();
                var acceptance = c as IConventionAcceptance <IPropertyInspector>;

                if (acceptance != null)
                {
                    acceptance.Accept(criteria);
                }

                return(criteria.Matches(new PropertyInspector(new PropertyMapping
                {
                    Type = new TypeReference(property.PropertyType),
                    Member = property
                })));
            });

            return(conventions.FirstOrDefault() != null);
        }
Esempio n. 2
0
 public IEnumerable <T> Find <T>() where T : IConvention
 {
     return(conventionFinder.Find <T>());
 }
Esempio n. 3
0
        public override void ProcessHibernateMapping(HibernateMapping hibernateMapping)
        {
            var conventions = finder.Find <IHibernateMappingConvention>();

            Apply <IHibernateMappingInspector, IHibernateMappingInstance>(conventions,
                                                                          new HibernateMappingInstance(hibernateMapping));
        }