示例#1
0
            /// <summary>
            /// Creates a new instance of the <see cref="EdmStructuralTypeInfo"/> class
            /// </summary>
            /// <param name="model">The Edm model.</param>
            /// <param name="structuredType">The Edm structured Type.</param>
            public EdmStructuralTypeInfo(IEdmModel model, IEdmStructuredType structuredType)
            {
                Contract.Assert(model != null);
                Contract.Assert(structuredType != null);

                foreach (var edmProperty in structuredType.Properties())
                {
                    switch (edmProperty.PropertyKind)
                    {
                    case EdmPropertyKind.Structural:
                        if (AllStructuralProperties == null)
                        {
                            AllStructuralProperties = new HashSet <IEdmStructuralProperty>();
                        }

                        AllStructuralProperties.Add((IEdmStructuralProperty)edmProperty);
                        break;

                    case EdmPropertyKind.Navigation:
                        if (AllNavigationProperties == null)
                        {
                            AllNavigationProperties = new HashSet <IEdmNavigationProperty>();
                        }

                        AllNavigationProperties.Add((IEdmNavigationProperty)edmProperty);
                        break;
                    }
                }

                IEdmEntityType entityType = structuredType as IEdmEntityType;

                if (entityType != null)
                {
                    var actions = model.GetAvailableActions(entityType);
                    AllActions = actions.Any() ? new HashSet <IEdmAction>(actions) : null;

                    var functions = model.GetAvailableFunctions(entityType);
                    AllFunctions = functions.Any() ? new HashSet <IEdmFunction>(functions) : null;
                }
            }
示例#2
0
 /// <summary>
 /// Tests whether a <see cref="IEdmStructuralProperty"/> is defined on this type.
 /// </summary>
 /// <param name="property">The test property.</param>
 /// <returns>True/false</returns>
 public bool IsStructuralPropertyDefined(IEdmStructuralProperty property)
 {
     return(AllStructuralProperties != null && AllStructuralProperties.Contains(property));
 }