Exemple #1
0
        public void AssertImplementedBy <T>(Expression <Func <T, object> > propertyRoute, Type typeToImplement) where T : Entity
        {
            var route = PropertyRoute.Construct(propertyRoute);

            Implementations imp = GetImplementations(route);

            if (imp.IsByAll || !imp.Types.Contains(typeToImplement))
            {
                throw new InvalidOperationException("Route {0} is not ImplementedBy {1}".FormatWith(route, typeToImplement.Name) +
                                                    "\r\n" +
                                                    Implementations.ConsiderMessage(route, imp.Types.And(typeToImplement).ToString(t => $"typeof({t.TypeName()})", ", ")));
            }
        }