public override void Apply(IEngineConfigurationType type)
 {
     mConventionProvider.Find <ITypeConvention>()
     .Select(t => (ITypeConvention)Activator.CreateInstance(t))
     .ToList()
     .ForEach(x => x.Apply(new TypeConventionContext(type)));
 }
Ejemplo n.º 2
0
        private void ApplyPropertyConventions(IEngineConfigurationTypeMember member)
        {
            var convention = mConventionProvider.Find <ITypePropertyConvention>()
                             .Select(t =>
            {
                var details = new
                {
                    Convention   = (ITypePropertyConvention)Activator.CreateInstance(t),
                    Requirements = new TypePropertyConventionRequirements()
                };
                details.Convention.SpecifyRequirements(details.Requirements);
                return(details);
            })
                             .Where(x => x.Requirements.IsValid((EngineTypePropertyMember)member.Member))
                             .OrderByDescending(x => ScoreRequirements(x.Requirements))
                             .FirstOrDefault();

            if (convention != null)
            {
                convention.Convention.Apply(new TypePropertyConventionContext(mConfiguration, member));
            }
        }