using Raven.Client.Documents.Session; using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Threading.Tasks; namespace zero.Core.Routing { public interface IRouteProvider : IRouteProvider { /// /// Find URL for an entity /// Task GetRoute(IAsyncDocumentSession session, T model, object parameters = null); /// /// Find URLs for mulitple entities /// Task> GetRoutes(IAsyncDocumentSession session, IEnumerable models, object parameters = null); /// /// Generate unique route ID for a model /// string GetRouteId(T model, object parameters = null); } public interface IRouteProvider { string Alias { get; } Type[] AffectedTypes { get; } /// /// Map a route to an MVC endpoint /// RouteProviderEndpoint MapEndpoint(IResolvedRoute route); /// /// Resolve a route and load optional dependencies into it. /// This is the data which is passed to the specified controller action. /// Task ResolveRoute(IAsyncDocumentSession session, Route route); /// /// Find URL for an entity /// Task GetRoute(IAsyncDocumentSession session, object model, object parameters = null); /// /// Find URLs for mulitple entities /// Task> GetRoutes(IAsyncDocumentSession session, IEnumerable models, object parameters = null); /// /// Rebuild all routes for this provider so they can be hydrated into the database /// Task> GetAllRoutes(IAsyncDocumentSession session); /// /// Generate unique route ID for a model /// string GetRouteId(object model, object parameters = null); } }