Files
mixtape/zero.Core/Routing/IRouteProvider.cs
T

56 lines
1.4 KiB
C#
Raw Normal View History

2020-10-23 15:50:59 +02:00
using Raven.Client.Documents.Session;
using System;
2020-10-26 13:59:46 +01:00
using System.Collections.Generic;
using System.Linq.Expressions;
2020-10-23 15:50:59 +02:00
using System.Threading.Tasks;
namespace zero.Core.Routing
{
public interface IRouteProvider<in T> : IRouteProvider
{
/// <summary>
/// Find URL for an entity
/// </summary>
Task<IRoute> GetRoute(IAsyncDocumentSession session, T model);
/// <summary>
2020-10-26 13:59:46 +01:00
/// Generate unique route ID for a model
2020-10-23 15:50:59 +02:00
/// </summary>
string GetRouteId(T model);
}
public interface IRouteProvider
{
string Alias { get; }
Type[] AffectedTypes { get; }
/// <summary>
/// Map a route to an MVC endpoint
/// </summary>
RouteProviderEndpoint MapEndpoint(IResolvedRoute route);
2020-10-26 13:59:46 +01:00
2020-10-23 15:50:59 +02:00
/// <summary>
/// Resolve a route and load optional dependencies into it.
/// This is the data which is passed to the specified controller action.
/// </summary>
Task<IResolvedRoute> ResolveRoute(IAsyncDocumentSession session, IRoute route);
/// <summary>
/// Find URL for an entity
/// </summary>
Task<IRoute> GetRoute(IAsyncDocumentSession session, object model);
/// <summary>
2020-10-26 13:59:46 +01:00
/// Rebuild all routes for this provider so they can be hydrated into the database
/// </summary>
Task<IList<IRoute>> GetAllRoutes(IAsyncDocumentSession session);
/// <summary>
/// Generate unique route ID for a model
2020-10-23 15:50:59 +02:00
/// </summary>
string GetRouteId(object model);
}
}