Ejemplo n.º 1
0
    public bool Match(HttpContext httpContext, IRouter route, string routeKey, IDictionary <string, object> values, RouteDirection routeDirection)
    {
        object deviceIdObject;

        if (!values.TryGetValue(routeKey, out deviceIdObject))
        {
            return(false);
        }
        string deviceId = deviceIdObject as string;

        if (deviceId == null)
        {
            return(false);
        }
        bool match = false;

        using (VRouterDbContext vRouterDb = new VRouterDbContext()) {
            match = vRouterDb.DeviceServiceAssociations
                    .AsNoTracking()
                    .Where(o => o.ControllerId == this.ControllerId)
                    .Any(o => o.AssoicatedDeviceId == deviceId);
        }
        return(match);
    }
Ejemplo n.º 2
0
 public VRouterConstraint (VRouterDbContext context, string controllerId) {
    this.DbContext = context;
    this.ControllerId = controllerId;
 }