comparison Source/DataAccess/IndexAttribute.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 using System;
2
3 using BLToolkit.Common;
4 using BLToolkit.Properties;
5
6 namespace BLToolkit.DataAccess
7 {
8 [AttributeUsage(AttributeTargets.Method), CLSCompliant(false)]
9 public class IndexAttribute : Attribute
10 {
11 public IndexAttribute(params string[] names)
12 {
13 if (null == names)
14 throw new ArgumentNullException("names");
15
16 if (names.Length == 0)
17 throw new ArgumentException(Resources.MapIndex_EmptyNames, "names");
18
19 _fields = NameOrIndexParameter.FromStringArray(names);
20 }
21
22 public IndexAttribute(params int[] indices)
23 {
24 if (null == indices)
25 throw new ArgumentNullException("indices");
26
27 if (indices.Length == 0)
28 throw new ArgumentException(Resources.MapIndex_EmptyIndices, "indices");
29
30 _fields = NameOrIndexParameter.FromIndexArray(indices);
31 }
32
33 public IndexAttribute(params NameOrIndexParameter[] fields)
34 {
35 if (null == fields)
36 throw new ArgumentNullException("fields");
37
38 if (fields.Length == 0)
39 throw new ArgumentException(Resources.MapIndex_EmptyFields, "fields");
40
41 _fields = fields;
42 }
43
44 private readonly NameOrIndexParameter[] _fields;
45 public NameOrIndexParameter[] Fields
46 {
47 get { return _fields; }
48 }
49 }
50 }