Exemple #1
0
        internal static IInterceptor[] SelectInterceptors(MethodInfo info, IInterceptor[] interceptors)
        {
            Type type = info.ReflectedType;

            if (_entites.Value.ContainsKey(type.FullName))
            {
                EntityClass entity = _entites.Value[type.FullName];
                if (entity.IsNotNull())
                {
                    EntityProperty property = entity.Properties.FirstOrDefault(p => p.GetInterceptorsId(info.Name).Count() > 0);
                    if (property.IsNotNull())
                    {
                        var query = from i in property.GetInterceptorsId(info.Name)
                                    join ii in interceptors.Where(i => i.IsTypeOf <Interceptor>()).Select(i => i.CastToType <Interceptor>())
                                    on i equals ii.GetId()
                                    select ii.CastToType <IInterceptor>();

                        return(query.ToArray());
                    }
                    else
                    {
                        return(new IInterceptor[0]);
                    }
                }
                else
                {
                    return(new IInterceptor[0]);
                }
            }
            else
            {
                return(new IInterceptor[0]);
            }
        }