2016-03-21 9 views
0

WCF'de (SharePoint içinde) bir veri kümesi üzerinde bir QueryInterceptor oluşturdum.QueryInterceptor çalışmıyor

"InitializeService" yöntemi çağrılıyor ve bu bir hata ayıklayabiliyorum, ancak QueryInterceptors'm işten kovulma.

[QueryInterceptor("Requests")] 
    public Expression<Func<Request, bool>> FilterRequests() 
    { 
     Debugger.Break(); 
     if (SPContext.Current == null) throw new DataServiceException(401, "Permission Denied"); 
     var spUser = SPContext.Current.Web.CurrentUser; 
     var spLoginName = spUser.LoginName; 
     var spGroups = spUser.Groups.Cast<SPGroup>().Select(x => x.Name); 
     if (spGroups.Any(x => x == _HRApproversGroupName)) 
      return (u) => true; 
     throw new DataServiceException(401, "Permission Denied"); 
    } 

public static void InitializeService(DataServiceConfiguration config) 
    { 
     config.SetEntitySetAccessRule("Users", EntitySetRights.AllRead); 
     config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; 
     config.UseVerboseErrors = true; 
    } 

Neyi yanlış yaptığımı veya henüz yapmadığımı bilen herkes var mı?

cevap

0

Sorun şu ki, yanlış QueryInterceptor'a başvuruda bulundu (başka bir derleme için başvuruda bulundu, ancak aynı ad alanlarıyla)