forked from serenity-is/Serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LeftJoinAttribute.cs
38 lines (35 loc) · 1.43 KB
/
LeftJoinAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
namespace Serenity.Data.Mapping
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = true)]
public class LeftJoinAttribute : Attribute, ISqlJoin
{
/// <summary>
/// Adds a left join on foreign key. Use this version only on properties with ForeignKey attribute.
/// </summary>
/// <param name="alias">Foreign join alias</param>
public LeftJoinAttribute(string alias)
{
this.Alias = alias;
}
/// <summary>
/// Adds a left join
/// </summary>
/// <param name="alias">Join alias</param>
/// <param name="toTable">Join table</param>
/// <param name="onCriteria">If the attribute is used on a property, this parameter is a field name, if used on a class,
/// this parameter is the ON criteria of the left join statement.</param>
public LeftJoinAttribute(string alias, string toTable, string onCriteria)
{
this.Alias = alias;
this.ToTable = toTable;
this.OnCriteria = onCriteria;
}
public String Alias { get; private set; }
public String ToTable { get; private set; }
public String OnCriteria { get; private set; }
public String PropertyPrefix { get; set; }
public String TitlePrefix { get; set; }
public Type RowType { get; set; }
}
}