Exemple #1
0
 public void Validate()
 {
     if (NodeTypes.All(nt => nt.Name != "Primary"))
     {
         throw new ArgumentException("Must have a single node type named 'Primary'");
     }
     NodeTypes = NodeTypes.OrderBy(nt => nt.Name == "Primary" ? 0 : 1).ToList();
 }
Exemple #2
0
        public void AddEdgeType <TFrom, TTo>(
            Expression <Func <TFrom, dynamic> > toKey,
            params Expression <Func <TFrom, dynamic> >[] properties)
            where TFrom : class where TTo : class
        {
            if (NodeTypes.All(n => n.NType != typeof(TFrom)) && GetKeyFunction <TFrom>() != null)
            {
                AddNodeType <TFrom>();
            }
            if (NodeTypes.All(n => n.NType != typeof(TTo)) && GetKeyFunction <TTo>() != null)
            {
                AddNodeType <TTo>();
            }

            var fromKey = GetKeyFunction <TFrom>();

            AddEdgeType <TFrom, TTo, TFrom>(fromKey, toKey, null, properties);
        }