Пример #1
0
        protected IEnumerable <T> GetElementsCore <T>(IEnumerable <GraphNode> query, ISchemaElement metadata, int skip) where T : IModelElement
        {
            ISchemaElement currentMetadata = null;
            var            cx = 0;

            foreach (var e in query)
            {
                if (e == null)
                {
                    continue;
                }

                if (currentMetadata == null || currentMetadata.Id != e.SchemaId)
                {
                    currentMetadata = _domainModel.Store.GetSchemaElement(e.SchemaId);
                }

                if (metadata == null || currentMetadata.IsA(metadata))
                {
                    if (cx++ >= skip)
                    {
                        var ctx = new SerializationContext(_domainModel, currentMetadata, e);
                        yield return((T)currentMetadata.Deserialize(ctx));
                    }
                }
            }
        }
Пример #2
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///  Peut-être une entity ou une relation.
        /// </summary>
        /// <param name="id">
        ///  .
        /// </param>
        /// <param name="schemaElement">
        ///  .
        /// </param>
        /// <returns>
        ///  The element.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------
        public IModelElement GetElement(Identity id, ISchemaElement schemaElement)
        {
            Contract.Requires(id, "id");

            GraphNode v;

            if (!GetGraphNode(id, NodeType.EdgeOrNode, out v) || v == null)
            {
                return(null);
            }

            var metadata = _domainModel.Store.GetSchemaElement(v.SchemaId);

            if (schemaElement != null && schemaElement.IsA(metadata))
            {
                metadata = schemaElement;
            }

            return((IModelElement)metadata.Deserialize(new SerializationContext(_domainModel, metadata, v)));
        }
Пример #3
0
        internal bool IsImpactedBy(ISchemaElement metaclass, string propertyName)
        {
            DebugContract.Requires(metaclass);

            return(metaclass.IsA(MetaClass) && (propertyName == null || (PropertyNames != null && PropertyNames[0] == propertyName)));
        }