private static void AddCollectionContributedAction(IReflector reflector, MethodInfo member, IObjectSpecImmutable type, ParameterInfo p, ContributedActionFacet facet, ContributedActionAttribute attribute) {
     if (!type.IsQueryable) {
         Log.WarnFormat("ContributedAction attribute added to a collection parameter type other than IQueryable: {0}", member.Name);
     }
     else {
         var returnType = reflector.LoadSpecification<IObjectSpecImmutable>(member.ReturnType);
         if (returnType.IsCollection) {
             Log.WarnFormat("ContributedAction attribute added to an action that returns a collection: {0}", member.Name);
         }
         else {
             Type elementType = p.ParameterType.GetGenericArguments()[0];
             type = reflector.LoadSpecification<IObjectSpecImmutable>(elementType);
             facet.AddCollectionContributee(type, attribute.SubMenu, attribute.Id);
         }
     }
 }
Esempio n. 2
0
        private static IImmutableDictionary <string, ITypeSpecBuilder> AddCollectionContributedAction(IReflector reflector, MethodInfo member, Type parameterType, ParameterInfo p, ContributedActionFacet facet, ContributedActionAttribute attribute, IImmutableDictionary <string, ITypeSpecBuilder> metamodel)
        {
            if (!CollectionUtils.IsGenericQueryable(parameterType))
            {
                //if (!type.IsQueryable) {
                Log.WarnFormat("ContributedAction attribute added to a collection parameter type other than IQueryable: {0}", member.Name);
            }
            else
            {
                var returnType = member.ReturnType;
                var result     = reflector.LoadSpecification(returnType, metamodel);
                metamodel = result.Item2;
                //var returnType = result.Item1 as IObjectSpecImmutable;
                if (IsCollection(returnType))
                {
                    Log.WarnFormat("ContributedAction attribute added to an action that returns a collection: {0}", member.Name);
                }
                else
                {
                    Type elementType = p.ParameterType.GetGenericArguments()[0];
                    result    = reflector.LoadSpecification(elementType, metamodel);
                    metamodel = result.Item2;
                    var type = result.Item1 as IObjectSpecImmutable;
                    facet.AddCollectionContributee(type, attribute.SubMenu, attribute.Id);
                }
            }

            return(metamodel);
        }
Esempio n. 3
0
 private static void AddCollectionContributedAction(IReflector reflector, MethodInfo member, IObjectSpecImmutable type, ParameterInfo p, ContributedActionFacet facet, ContributedActionAttribute attribute)
 {
     if (!type.IsQueryable)
     {
         Log.WarnFormat("ContributedAction attribute added to a collection parameter type other than IQueryable: {0}", member.Name);
     }
     else
     {
         var returnType = reflector.LoadSpecification <IObjectSpecImmutable>(member.ReturnType);
         if (returnType.IsCollection)
         {
             Log.WarnFormat("ContributedAction attribute added to an action that returns a collection: {0}", member.Name);
         }
         else
         {
             Type elementType = p.ParameterType.GetGenericArguments()[0];
             type = reflector.LoadSpecification <IObjectSpecImmutable>(elementType);
             facet.AddCollectionContributee(type, attribute.SubMenu, attribute.Id);
         }
     }
 }