Exemplo n.º 1
0
        public IEnumerable <ISonesIndex> GetIndices(IVertexType myVertexType, IList <IPropertyDefinition> myPropertyDefinition, SecurityToken mySecurityToken, Int64 myTransactionToken)
        {
            myVertexType.CheckNull("myVertexType");
            myPropertyDefinition.CheckNull("myPropertyDefinition");

            if (myPropertyDefinition.Count == 0)
            {
                throw new ArgumentOutOfRangeException("myPropertyDefinition", "At least one property must be given.");
            }

            var propertyTypes = myPropertyDefinition.GroupBy(_ => _.RelatedType);

            foreach (var group in propertyTypes)
            {
                if (!myVertexType.IsDescendantOrSelf(group.Key))
                {
                    throw new ArgumentException(string.Format("The properties ({0}) defined on type {1} is not part of inheritance hierarchy of {2}.",
                                                              string.Join(",", group.Select(_ => _.Name)),
                                                              group.Key.Name,
                                                              myVertexType.Name));
                }
            }

            var result = myVertexType.GetIndexDefinitions(false).Where(_ => myPropertyDefinition.SequenceEqual(_.IndexedProperties)).Select(_ => _indices[_.ID]).ToArray();

            return(result);
        }
Exemplo n.º 2
0
 public IEnumerable<ISonesIndex> GetIndices(IVertexType myVertexType, IPropertyDefinition myPropertyDefinition, SecurityToken mySecurityToken, Int64 myTransactionToken)
 {
     myVertexType.CheckNull("myVertexType");
     return myVertexType.GetIndexDefinitions(false).Where(_=>_.IndexedProperties.Count == 1 && _.IndexedProperties.Contains(myPropertyDefinition)).Select(_ => _indices[_.ID]);
     //return myPropertyDefinition.InIndices.Where(_ => myVertexType.Equals(_.VertexType)).Select(_ => _indices[_.ID]);
 }
Exemplo n.º 3
0
        public IEnumerable<ISonesIndex> GetIndices(IVertexType myVertexType, IList<IPropertyDefinition> myPropertyDefinition, SecurityToken mySecurityToken, Int64 myTransactionToken)
        {
            myVertexType.CheckNull("myVertexType");
            myPropertyDefinition.CheckNull("myPropertyDefinition");

            if (myPropertyDefinition.Count == 0)
                throw new ArgumentOutOfRangeException("myPropertyDefinition", "At least one property must be given.");

            var propertyTypes = myPropertyDefinition.GroupBy(_ => _.RelatedType);
            foreach (var group in propertyTypes)
            {
                if (!myVertexType.IsDescendantOrSelf(group.Key))
                {
                    throw new ArgumentException(string.Format("The properties ({0}) defined on type {1} is not part of inheritance hierarchy of {2}.",
                        string.Join(",", group.Select(_ => _.Name)),
                        group.Key.Name,
                        myVertexType.Name));
                }
            }

            var result = myVertexType.GetIndexDefinitions(false).Where(_ => myPropertyDefinition.SequenceEqual(_.IndexedProperties)).Select(_=>_indices[_.ID]).ToArray();

            return result;
        }
Exemplo n.º 4
0
        //private bool GetIsSingleValue(IIndex<IComparable, long> index)
        //{
        //    return index is ISingleValueIndex<IComparable, Int64>;
        //}

        #region IIndexManager Members


        public IEnumerable <ISonesIndex> GetIndices(IVertexType myVertexType, IPropertyDefinition myPropertyDefinition, SecurityToken mySecurityToken, Int64 myTransactionToken)
        {
            myVertexType.CheckNull("myVertexType");
            return(myVertexType.GetIndexDefinitions(false).Where(_ => _.IndexedProperties.Count == 1 && _.IndexedProperties.Contains(myPropertyDefinition)).Select(_ => _indices[_.ID]));
            //return myPropertyDefinition.InIndices.Where(_ => myVertexType.Equals(_.VertexType)).Select(_ => _indices[_.ID]);
        }