Пример #1
0
        /// <summary>
        /// upsert edge and ensure to side is unique
        /// </summary>
        /// <typeparam name="TEdge"></typeparam>
        /// <typeparam name="TFrom"></typeparam>
        /// <typeparam name="TTo"></typeparam>
        /// <param name="arangoDatabase"></param>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="setter"></param>
        /// <returns></returns>
        public static TEdge UpsertEdgeUniqueTo <TEdge, TFrom, TTo>(this IArangoDatabase arangoDatabase, TFrom from, TTo to, Action <TEdge> setter = null) where TEdge : EdgeBase, new() where TFrom : VertexBase where TTo : VertexBase
        {
            TEdge edge = new TEdge();

            edge._from = from.GetId();
            edge._to   = to.GetId();
            edge.BuildIdWithFromTo();
            setter?.Invoke(edge);
            arangoDatabase.UpsertEdgeUniqueTo(edge);
            return(edge);
        }