1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
7
using System.Collections.Generic;
10
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Common;
11
using System.ComponentModel;
12
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Type;
13
using System.Collections;
14
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.MSL.Association;
15
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Common;
19
namespace ICSharpCode.Data.EDMDesigner.Core.EDMObjects.CSDL.Property
21
public class NavigationProperty : PropertyBase
25
private Cardinality _cardinality;
26
private Visibility _setVisibility;
27
private bool _generate = true;
28
private EntityType _relatedEntityType;
29
private AssociationRoleMapping _mapping;
35
public NavigationProperty(Association.Association association)
37
Association = association;
44
public new EntityType EntityType
46
get { return base.EntityType as EntityType; }
47
internal set { base.EntityType = value; }
50
protected override Func<TypeBase, IList> GetPropertyCollection
57
var entityType = baseType as EntityType;
58
if (entityType == null)
59
return new List<NavigationProperty>();
60
return entityType.NavigationProperties;
65
public Association.Association Association { get; private set; }
67
public EntityType RelatedEntityType
71
if (_relatedEntityType == null)
72
_relatedEntityType = Association.PropertiesEnd.First(np => np != this).EntityType;
73
return _relatedEntityType;
77
[DisplayName("Multiplicity")]
78
public Cardinality Cardinality
80
get { return _cardinality; }
84
OnPropertyChanged("Cardinality");
85
OnCardinalityChanged();
89
[DisplayName("Setter")]
90
public Visibility SetVisibility
92
get { return _setVisibility; }
95
_setVisibility = value;
96
OnPropertyChanged("SetVisibility");
100
[DisplayName("Generate")]
103
get { return _generate; }
107
OnPropertyChanged("Generate");
111
public AssociationRoleMapping Mapping
115
if (_mapping == null)
116
_mapping = new AssociationRoleMapping(this);
121
internal bool IsDeleted { get; set; }
125
protected override PropertyBase Create()
127
throw new NotImplementedException();
130
protected virtual void OnCardinalityChanged()
132
if (CardinalityChanged != null)
133
CardinalityChanged();
135
public event Action CardinalityChanged;