|
@@ -1712,49 +1712,9 @@ namespace InABox.Core
|
|
|
return sanitisedNamePart;
|
|
|
}
|
|
|
|
|
|
- private static Dictionary<(Type type, string column), decimal> _columnsequences = new Dictionary<(Type, string), decimal>();
|
|
|
-
|
|
|
- private static decimal CalculatePropertySequence(IProperty? property)
|
|
|
- {
|
|
|
- var sequence = 0.0M;
|
|
|
- if(property is null)
|
|
|
- {
|
|
|
- sequence = 999;
|
|
|
- }
|
|
|
- else if (property is CustomProperty)
|
|
|
- {
|
|
|
- sequence = property.Sequence;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- while(property != null)
|
|
|
- {
|
|
|
- sequence = property.Sequence + sequence / 1000.0M;
|
|
|
-
|
|
|
- property = property.Parent;
|
|
|
- }
|
|
|
- }
|
|
|
- return sequence;
|
|
|
- }
|
|
|
-
|
|
|
- public static decimal GetPropertySequence(IProperty property)
|
|
|
- {
|
|
|
- if (!_columnsequences.TryGetValue((property.ClassType!, property.Name), out var sequence))
|
|
|
- {
|
|
|
- sequence = CalculatePropertySequence(property);
|
|
|
- _columnsequences.Add((property.ClassType!, property.Name), sequence);
|
|
|
- }
|
|
|
- return sequence;
|
|
|
- }
|
|
|
-
|
|
|
public static decimal GetPropertySequence(Type type, string column)
|
|
|
{
|
|
|
- if(!_columnsequences.TryGetValue((type, column), out var sequence))
|
|
|
- {
|
|
|
- sequence = CalculatePropertySequence(DatabaseSchema.Property(type, column));
|
|
|
- _columnsequences.Add((type, column), sequence);
|
|
|
- }
|
|
|
- return sequence;
|
|
|
+ return DatabaseSchema.Property(type, column)?.PropertySequence() ?? 999;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|