Files
mixtape/zero.Core/Routing/Entities/Route.cs
T

78 lines
1.7 KiB
C#
Raw Normal View History

2021-10-06 14:55:50 +02:00
using System;
using System.Collections.Generic;
2020-10-12 12:00:30 +02:00
using zero.Core.Attributes;
using zero.Core.Entities;
namespace zero.Core.Routing
{
[Collection("Routes")]
2021-05-04 17:23:52 +02:00
public class Route : ZeroIdEntity
2020-10-12 12:00:30 +02:00
{
2021-10-05 15:50:12 +02:00
public Route() { }
public Route(string providerAlias)
{
ProviderAlias = providerAlias;
}
2021-10-06 14:55:50 +02:00
public Route(string id, string url, string providerAlias)
{
Id = id;
Url = url;
ProviderAlias = providerAlias;
}
2021-11-05 13:46:07 +01:00
/// <summary>
/// Id of the referenced entity
/// </summary>
public string ReferenceId { get; set; }
2021-05-04 17:23:52 +02:00
/// <summary>
/// Generated URL based on the URL provider
/// </summary>
2020-10-12 12:00:30 +02:00
public string Url { get; set; }
2021-05-04 17:23:52 +02:00
/// <summary>
/// Alias of the URL provider which generated this route
/// </summary>
2020-10-21 14:11:58 +02:00
public string ProviderAlias { get; set; }
2021-05-04 17:23:52 +02:00
/// <summary>
/// Enable this property so all routes are catched which start with this Url
/// </summary>
2020-10-21 14:11:58 +02:00
public bool AllowSuffix { get; set; }
2021-05-04 17:23:52 +02:00
/// <summary>
/// Additional parameters
/// </summary>
public Dictionary<string, object> Params { get; set; } = new();
2020-10-12 12:00:30 +02:00
2021-05-04 17:23:52 +02:00
/// <summary>
/// Contains references to the resolved collection entities
/// </summary>
2021-10-13 12:47:18 +02:00
//[Obsolete]
2021-05-04 17:23:52 +02:00
public List<RouteReference> References { get; set; } = new();
2020-10-21 14:11:58 +02:00
2021-05-04 17:23:52 +02:00
/// <summary>
/// Route dependencies can be used for cache busting
/// </summary>
public List<string> Dependencies { get; set; } = new();
2020-10-12 12:00:30 +02:00
}
public class RouteReference
{
public string Id { get; set; }
public string Collection { get; set; }
public RouteReference() { }
public RouteReference(string id, string collection)
{
Id = id;
Collection = collection;
}
}
}