-
-
Notifications
You must be signed in to change notification settings - Fork 523
Expand file tree
/
Copy pathIgnoreAttribute.cs
More file actions
39 lines (37 loc) · 938 Bytes
/
IgnoreAttribute.cs
File metadata and controls
39 lines (37 loc) · 938 Bytes
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
39
using System;
namespace SqlKata
{
/// <summary>
/// This class is used as metadata to ignore a property on insert and update queries
/// </summary>
/// <example>
/// <code>
/// public class Person
/// {
/// public string Name {get ;set;}
///
/// [Ignore]
/// public string PhoneNumber {get ;set;}
///
/// }
///
/// new Query("Table").Insert(new Person { Name = "User", PhoneNumber = "70123456" })
///
/// output: INSERT INTO [Table] ([Name]) VALUES('User')
/// </code>
/// </example>
public class IgnoreAttribute : Attribute
{
public IgnoreOperation IgnoreOperation { get; }
public IgnoreAttribute(IgnoreOperation ignoreOperation = IgnoreOperation.Always)
{
IgnoreOperation = ignoreOperation;
}
}
public enum IgnoreOperation
{
OnInsert,
OnUpdate,
Always
}
}