Exemplo n.º 1
0
        /// <summary>
        /// Specifies the connection which is to be used in the execution.
        /// </summary>
        /// <param name="connectionKey">Is a connection key as specified in the connection delegate method.</param>
        public static ConnectBy ConnectBy(ConnectionKey connectionKey)
        {
            return(Call <ConnectBy>(Assembly.GetCallingAssembly(), (ca) =>
            {
                if (connectionKey == null)
                {
                    _Throw(QueryTalkExceptionType.ArgumentNull, "connectionKey", ".ConnectBy");
                }

                return new ConnectBy(new d(), connectionKey);
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Specifies a connection to be used in execution.
        /// </summary>
        /// <typeparam name="T">The IConnectable type.</typeparam>
        /// <param name="connectable">A predecessor object.</param>+
        /// <param name="connectionKey">A connection key that determines the connection.</param>
        public static T ConnectBy <T>(this T connectable, ConnectionKey connectionKey)
            where T : IConnectable
        {
            if (connectable is DbNode)
            {
                // the connection key of a node graph should be bound to the subject
                ((IConnectable)((DbNode)(object)connectable).Root).SetConnectionKey(connectionKey);
            }
            else if (connectable is DbRow)
            {
                var row = (DbRow)(object)connectable;
                row.TrySetNode();
                connectable.SetConnectionKey(connectionKey);
            }
            else
            {
                connectable.SetConnectionKey(connectionKey);
            }

            return(connectable);
        }