FreeSql/FreeSql/DataAnnotations/NavigateAttribute.cs
2022-05-25 13:46:33 +08:00

46 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Linq;
namespace FreeSql.DataAnnotations
{
/// <summary>
/// OneToOne[Navigate(nameof(Primary))] &lt;-&gt; (缺省)外表.Primary<para></para>
/// ManyToOneTopic.cs 文件 [Navigate(nameof(Topic.CategoryId))] &lt;-&gt; (缺省)Category.Id<para></para>
/// _________________public Category Category { get; set; }<para></para>
/// OneToManyCategory.cs 文件 (缺省)Category.Id &lt;-&gt; [Navigate(nameof(Topic.CategoryId))]<para></para>
/// _________________public List&lt;Topic&gt; Topics { get; set; }<para></para>
/// </summary>
public class NavigateAttribute : Attribute
{
/// <summary>
/// OneToOne[Navigate(nameof(Primary))] &lt;-&gt; (缺省)外表.Primary<para></para>
/// ManyToOneTopic.cs 文件 [Navigate(nameof(Topic.CategoryId))] &lt;-&gt; (缺省)Category.Id<para></para>
/// _________________public Category Category { get; set; }<para></para>
/// OneToManyCategory.cs 文件 (缺省)Category.Id &lt;-&gt; [Navigate(nameof(Topic.CategoryId))]<para></para>
/// _________________public List&lt;Topic&gt; Topics { get; set; }<para></para>
/// </summary>
public string Bind { get; set; }
/// <summary>
/// 手工绑定 ManyToMany 导航关系
/// </summary>
public Type ManyToMany { get; set; }
/// <summary>
/// OneToOne[Navigate(nameof(Primary))] &lt;-&gt; (缺省)外表.Primary<para></para>
/// ManyToOneTopic.cs 文件 [Navigate(nameof(Topic.CategoryId))] &lt;-&gt; (缺省)Category.Id<para></para>
/// _________________public Category Category { get; set; }<para></para>
/// OneToManyCategory.cs 文件 (缺省)Category.Id &lt;-&gt; [Navigate(nameof(Topic.CategoryId))]<para></para>
/// _________________public List&lt;Topic&gt; Topics { get; set; }<para></para>
/// </summary>
public NavigateAttribute(string bind)
{
this.Bind = bind;
}
public NavigateAttribute()
{
}
}
}