add route index
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
using Raven.Client.Documents.Indexes;
|
||||
using System.Linq;
|
||||
using zero.Core.Routing;
|
||||
|
||||
namespace zero.Core.Database.Indexes
|
||||
{
|
||||
public class Routes_ForResolver : AbstractIndexCreationTask<Route>
|
||||
{
|
||||
public Routes_ForResolver()
|
||||
{
|
||||
Map = items => items
|
||||
.Select(x => new
|
||||
{
|
||||
Url = x.Url,
|
||||
AllowSuffix = x.AllowSuffix
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using zero.Core.Database;
|
||||
using zero.Core.Database.Indexes;
|
||||
using zero.Core.Entities;
|
||||
using zero.Core.Extensions;
|
||||
using zero.Core.Options;
|
||||
@@ -138,7 +139,7 @@ namespace zero.Core.Routing
|
||||
min -= 1;
|
||||
}
|
||||
|
||||
IList<Route> routes = await session.Query<Route>()
|
||||
IList<Route> routes = await session.Query<Route, Routes_ForResolver>()
|
||||
.Where(x => (!x.AllowSuffix && x.Url == path) || (x.AllowSuffix && x.Url.In(parts)))
|
||||
.Include("References[].Id")
|
||||
.Include("Dependencies")
|
||||
|
||||
Reference in New Issue
Block a user