Beispiel #1
0
        private void DetectObjectType(DbCommandWrapper info)
        {
            var schema = "dbo";
            var name   = info.ObjectName;

            if (name.Contains("."))
            {
                schema = name.Split('.')[0];
                name   = name.Split('.')[1];
            }
            var query = string.Format(GetObjectTypeInfoQueryTemplate, schema, name);

            if (null == ProxyExecutor)
            {
                DetectTypeByOwnConnection(info, query);
            }
            else
            {
                var callProxy = info.CloneNoQuery();
                callProxy.Query    = query;
                callProxy.Notation = DbCallNotation.Scalar;
                ProxyExecutor.Execute(callProxy).Wait();
                SetupObjectTypeValue(info, callProxy.Result);
            }
        }
Beispiel #2
0
        private void SetupByProxy(DbCommandWrapper info, string query)
        {
            var proxyCall = info.CloneNoQuery();

            proxyCall.Query    = query;
            proxyCall.Notation = DbCallNotation.Reader;

            ProxyExecutor.Execute(proxyCall).Wait();
            if (proxyCall.Ok)
            {
                var result     = (object[])proxyCall.Result;
                var parameters = new List <DbParameter>();
                foreach (IDictionary <string, object> record in result)
                {
                    parameters.Add(SetupParameter(record["name"].ToStr(), record["type"].ToStr()));
                }
                info.Parameters = parameters.ToArray();
            }
            else
            {
                throw proxyCall.Error;
            }
        }