Exemplo n.º 1
0
        /*--------------------------------------------------------------------------------------------*/
        private IWeaverPathPipeEnd MakePropertyKey <T>(string pElement, Expression <Func <T, object> > pProp,
                                                       IWeaverVarAlias pGroupVar = null) where T : IWeaverElement
        {
            WeaverPropPair wpp = WeaverUtil.GetPropertyAttribute(pProp);
            WeaverTitanPropertyAttribute att = WeaverTitanUtil.GetAndVerifyTitanPropertyAttribute(wpp);
            Type pt = wpp.Info.PropertyType;

            AddCustom("makeType()");
            AddCustom("dataType(" + WeaverTitanPropertyAttribute.GetTitanTypeName(pt) + ".class)");
            AddCustom("name(" + Path.Query.AddParam(new WeaverQueryVal(att.DbName)) + ")");
            AddCustom("unique(OUT)");             //WeaverConfig enforces unique property DbNames

            if (pGroupVar != null)
            {
                AddCustom("group(" + pGroupVar.Name + ")");
            }

            if (att.TitanIndex)
            {
                AddCustom("indexed(" + pElement + ".class)");
            }

            if (att.TitanElasticIndex)
            {
                AddCustom("indexed('search'," + pElement + ".class)");
            }

            return(AddCustom("makePropertyKey()"));
        }
Exemplo n.º 2
0
        /*--------------------------------------------------------------------------------------------*/
        private static void ConfirmVciState <TEdge, TVert> (TEdge pEdge,
                                                            Expression <Func <TVert, object> > pProperty)
            where TEdge : IWeaverEdge where TVert : IWeaverVertex
        {
            Type et = typeof(TEdge);
            Type vt = typeof(TVert);

            WeaverTitanUtil.GetAndVerifyElementAttribute <WeaverTitanEdgeAttribute> (et);
            WeaverTitanUtil.GetAndVerifyElementAttribute <WeaverTitanVertexAttribute> (vt);

            if (pEdge.OutVertexType != vt && pEdge.InVertexType != vt)
            {
                throw new WeaverException("Vertex type '" + vt.Name + "' is not valid for edge type '" +
                                          et.Name + "'.");
            }

            WeaverPropPair wpp = WeaverUtil.GetPropertyAttribute(pProperty);
            WeaverTitanPropertyAttribute att = WeaverTitanUtil.GetAndVerifyTitanPropertyAttribute(wpp);

            if (!att.HasTitanVertexCentricIndex(et))
            {
                throw new WeaverException("Property '" + vt.Name + "." + wpp.Info.Name + "' does not have a " +
                                          "vertex-centric index for edge '" + et.Name + "'.");
            }
        }
Exemplo n.º 3
0
        public void GetPropertyAttribute()
        {
            WeaverPropPair result = WeaverUtil.GetPropertyAttribute <Person>(x => x.Age);

            Assert.NotNull(result, "Result should be filled.");
            Assert.AreEqual("Age", result.Info.Name, "Incorrect result PropertyInfo.Name.");
        }