DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Package Functions | Properties | Private Attributes | List of all members
Deveel.Data.Mapping.MappingModel Class Reference

Public Member Functions

bool IsMapped (Type type)
 
TypeMapping GetMapping (Type type)
 
Relationship GetRelationship (Type sourceType, string sourceMember)
 

Package Functions

 MappingModel ()
 
void Map (TypeMapping mapping)
 
void AddRelationship (Relationship relationship)
 
QueryMapping CreateQueryMapping ()
 

Properties

IEnumerable< Type > Types [get]
 
IEnumerable< TypeMappingTypeMappings [get]
 
IEnumerable< RelationshipRelationships [get]
 

Private Attributes

readonly Dictionary< Type, TypeMappingtypeMappings
 
readonly List< Relationshiprelationships
 

Detailed Description

Definition at line 11 of file MappingModel.cs.

Constructor & Destructor Documentation

Deveel.Data.Mapping.MappingModel.MappingModel ( )
inlinepackage

Definition at line 15 of file MappingModel.cs.

15  {
16  typeMappings = new Dictionary<Type, TypeMapping>();
17  relationships = new List<Relationship>();
18  }
readonly Dictionary< Type, TypeMapping > typeMappings
Definition: MappingModel.cs:12
readonly List< Relationship > relationships
Definition: MappingModel.cs:13

Member Function Documentation

void Deveel.Data.Mapping.MappingModel.AddRelationship ( Relationship  relationship)
inlinepackage

Definition at line 24 of file MappingModel.cs.

24  {
25  if (relationship == null)
26  throw new ArgumentNullException("relationship");
27 
28  if (!IsMapped(relationship.SourceType))
29  throw new ArgumentException(String.Format("Type '{0}' source of the relationship is not mapped.", relationship.SourceType));
30  if (!IsMapped(relationship.TargetType))
31  throw new ArgumentException(String.Format("Type '{0}' destination of the relationship is not mapped.", relationship.TargetType));
32 
33  var typeMapping = GetMapping(relationship.SourceType);
34  if (!typeMapping.IsMemberMapped(relationship.SourceMember))
35  throw new ArgumentException(String.Format("Member '{0}' in type '{1}' source of the relationship is not mapped",
36  relationship.SourceMember, relationship.SourceType));
37 
38  relationships.Add(relationship);
39  }
A long string in the system.
readonly List< Relationship > relationships
Definition: MappingModel.cs:13
TypeMapping GetMapping(Type type)
Definition: MappingModel.cs:57
QueryMapping Deveel.Data.Mapping.MappingModel.CreateQueryMapping ( )
inlinepackage

Definition at line 73 of file MappingModel.cs.

73  {
74  return new DeveelDbMapping(this);
75  }
TypeMapping Deveel.Data.Mapping.MappingModel.GetMapping ( Type  type)
inline

Definition at line 57 of file MappingModel.cs.

57  {
58  if (type == null)
59  throw new ArgumentNullException("type");
60 
61  TypeMapping mapping;
62  if (!typeMappings.TryGetValue(type, out mapping))
63  return null;
64 
65  return mapping;
66  }
readonly Dictionary< Type, TypeMapping > typeMappings
Definition: MappingModel.cs:12
Relationship Deveel.Data.Mapping.MappingModel.GetRelationship ( Type  sourceType,
string  sourceMember 
)
inline

Definition at line 68 of file MappingModel.cs.

68  {
69  return relationships.FirstOrDefault(x => x.SourceType == sourceType &&
70  x.SourceMember == sourceMember);
71  }
readonly List< Relationship > relationships
Definition: MappingModel.cs:13
bool Deveel.Data.Mapping.MappingModel.IsMapped ( Type  type)
inline

Definition at line 53 of file MappingModel.cs.

53  {
54  return typeMappings.ContainsKey(type);
55  }
readonly Dictionary< Type, TypeMapping > typeMappings
Definition: MappingModel.cs:12
void Deveel.Data.Mapping.MappingModel.Map ( TypeMapping  mapping)
inlinepackage

Definition at line 20 of file MappingModel.cs.

20  {
21  typeMappings[mapping.Type] = mapping;
22  }
readonly Dictionary< Type, TypeMapping > typeMappings
Definition: MappingModel.cs:12

Member Data Documentation

readonly List<Relationship> Deveel.Data.Mapping.MappingModel.relationships
private

Definition at line 13 of file MappingModel.cs.

readonly Dictionary<Type, TypeMapping> Deveel.Data.Mapping.MappingModel.typeMappings
private

Definition at line 12 of file MappingModel.cs.

Property Documentation

IEnumerable<Relationship> Deveel.Data.Mapping.MappingModel.Relationships
get

Definition at line 49 of file MappingModel.cs.

IEnumerable<TypeMapping> Deveel.Data.Mapping.MappingModel.TypeMappings
get

Definition at line 45 of file MappingModel.cs.

IEnumerable<Type> Deveel.Data.Mapping.MappingModel.Types
get

Definition at line 41 of file MappingModel.cs.


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