DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Package Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.Mapping.MemberMappingConfiguration< T > Class Template Reference
Inheritance diagram for Deveel.Data.Mapping.MemberMappingConfiguration< T >:
Deveel.Data.Mapping.IMemberMappingConfiguration

Public Member Functions

MemberMappingConfiguration< T > HasName (string columnName)
 
MemberMappingConfiguration< T > HasType (SqlTypeCode typeCode)
 
MemberMappingConfiguration< T > HasSize (int size)
 
MemberMappingConfiguration< T > IsUnique (bool flag=true)
 
MemberMappingConfiguration< T > IsNotNull (bool flag=true)
 
MemberMappingConfiguration< T > IsPrimaryKey (bool flag=true)
 
void Ignore ()
 

Package Functions

 MemberMappingConfiguration (TypeMappingConfiguration< T > typeMapping, MemberInfo memberInfo)
 

Properties

string ColumnName [get, set]
 
SqlTypeCode ColumnTypeCode [get, set]
 
int Size [get, set]
 
int Precision [get, set]
 
ColumnConstraints ColumnConstraints [get, set]
 
MemberInfo IMemberMappingConfiguration. Member [get]
 
string IMemberMappingConfiguration. ColumnName [get]
 
SqlTypeCode IMemberMappingConfiguration. ColumnType [get]
 
ColumnConstraints IMemberMappingConfiguration. ColumnConstraints [get]
 
int IMemberMappingConfiguration. Size [get]
 
int IMemberMappingConfiguration. Precision [get]
 
- Properties inherited from Deveel.Data.Mapping.IMemberMappingConfiguration
MemberInfo Member [get]
 
string ColumnName [get]
 
SqlTypeCode ColumnType [get]
 
int Size [get]
 
int Precision [get]
 
ColumnConstraints ColumnConstraints [get]
 

Private Member Functions

void DiscoverAttributes ()
 

Private Attributes

readonly MemberInfo memberInfo
 
readonly TypeMappingConfiguration< T > typeMapping
 

Detailed Description

Type Constraints
T :class 

Definition at line 9 of file MemberMappingConfiguration.cs.

Constructor & Destructor Documentation

Deveel.Data.Mapping.MemberMappingConfiguration< T >.MemberMappingConfiguration ( TypeMappingConfiguration< T >  typeMapping,
MemberInfo  memberInfo 
)
inlinepackage

Member Function Documentation

void Deveel.Data.Mapping.MemberMappingConfiguration< T >.DiscoverAttributes ( )
inlineprivate

Definition at line 34 of file MemberMappingConfiguration.cs.

34  {
35  string columnName = null;
36  ColumnConstraints constraints = new ColumnConstraints();
37  SqlTypeCode? typeCode = null;
38  int? size = null;
39  int? scale = null;
40 
41  var attributes = memberInfo.GetCustomAttributes(false);
42  foreach (var attribute in attributes) {
43  if (attribute is ColumnNameAttribute) {
44  var columnNameAttr = (ColumnNameAttribute) attribute;
45  ColumnName = columnNameAttr.ColumnName;
46  } else if (attribute is ColumnAttribute) {
47  var columnAttr = (ColumnAttribute) attribute;
48  columnName = columnAttr.ColumnName;
49  typeCode = columnAttr.SqlType;
50  size = columnAttr.Size;
51  scale = columnAttr.Scale;
52  } else if (attribute is ColumnConstraintAttribute) {
53  var constraintAttr = (ColumnConstraintAttribute) attribute;
54  constraints |= constraintAttr.Constraints;
55  }
56  }
57 
58  ColumnName = columnName;
59  ColumnTypeCode = typeCode;
60  ColumnConstraints = constraints;
61  Size = size;
62  Precision = scale;
63  }
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
MemberMappingConfiguration<T> Deveel.Data.Mapping.MemberMappingConfiguration< T >.HasName ( string  columnName)
inline

Definition at line 85 of file MemberMappingConfiguration.cs.

85  {
86  ColumnName = columnName;
87  return this;
88  }

Definition at line 95 of file MemberMappingConfiguration.cs.

95  {
96  Size = size;
97  return this;
98  }

Definition at line 90 of file MemberMappingConfiguration.cs.

90  {
91  ColumnTypeCode = typeCode;
92  return this;
93  }

Definition at line 130 of file MemberMappingConfiguration.cs.

130  {
131  typeMapping.Ignore(memberInfo.Name);
132  }
readonly TypeMappingConfiguration< T > typeMapping
MemberMappingConfiguration<T> Deveel.Data.Mapping.MemberMappingConfiguration< T >.IsNotNull ( bool  flag = true)
inline

Definition at line 110 of file MemberMappingConfiguration.cs.

110  {
111  if (flag) {
113  } else {
114  ColumnConstraints &= ~(ColumnConstraints.NotNull);
115  }
116 
117  return this;
118  }
MemberMappingConfiguration<T> Deveel.Data.Mapping.MemberMappingConfiguration< T >.IsPrimaryKey ( bool  flag = true)
inline

Definition at line 120 of file MemberMappingConfiguration.cs.

120  {
121  if (flag) {
122  ColumnConstraints |= ColumnConstraints.PrimaryKey;
123  } else {
124  ColumnConstraints &= ~(ColumnConstraints.PrimaryKey);
125  }
126 
127  return this;
128  }
MemberMappingConfiguration<T> Deveel.Data.Mapping.MemberMappingConfiguration< T >.IsUnique ( bool  flag = true)
inline

Definition at line 100 of file MemberMappingConfiguration.cs.

100  {
101  if (flag) {
103  } else {
105  }
106 
107  return this;
108  }

Member Data Documentation

readonly MemberInfo Deveel.Data.Mapping.MemberMappingConfiguration< T >.memberInfo
private

Definition at line 10 of file MemberMappingConfiguration.cs.

Definition at line 11 of file MemberMappingConfiguration.cs.

Property Documentation

Definition at line 28 of file MemberMappingConfiguration.cs.

Definition at line 73 of file MemberMappingConfiguration.cs.

string Deveel.Data.Mapping.MemberMappingConfiguration< T >.ColumnName
getsetprivate

Definition at line 20 of file MemberMappingConfiguration.cs.

string IMemberMappingConfiguration. Deveel.Data.Mapping.MemberMappingConfiguration< T >.ColumnName
getprivate

Definition at line 65 of file MemberMappingConfiguration.cs.

SqlTypeCode IMemberMappingConfiguration. Deveel.Data.Mapping.MemberMappingConfiguration< T >.ColumnType
getprivate

Definition at line 69 of file MemberMappingConfiguration.cs.

Definition at line 22 of file MemberMappingConfiguration.cs.

MemberInfo IMemberMappingConfiguration. Deveel.Data.Mapping.MemberMappingConfiguration< T >.Member
getprivate

Definition at line 30 of file MemberMappingConfiguration.cs.

int Deveel.Data.Mapping.MemberMappingConfiguration< T >.Precision
getsetprivate

Definition at line 26 of file MemberMappingConfiguration.cs.

int IMemberMappingConfiguration. Deveel.Data.Mapping.MemberMappingConfiguration< T >.Precision
getprivate

Definition at line 81 of file MemberMappingConfiguration.cs.

Definition at line 24 of file MemberMappingConfiguration.cs.

int IMemberMappingConfiguration. Deveel.Data.Mapping.MemberMappingConfiguration< T >.Size
getprivate

Definition at line 77 of file MemberMappingConfiguration.cs.


The documentation for this class was generated from the following file: