Exemplo n.º 1
0
        public async Task <Cluster> GetClusterByID(long id)
        {
            var clusterMapper = new ClusterMappers();

            var param = new DynamicParameters();

            param.Add("@ID", id);

            return((await SqlMapper.QueryAsync(
                        _unitOfWork.Connection,
                        "GetClusterByID",
                        new[]
            {
                typeof(Cluster),
                typeof(string),
                typeof(Log),
                typeof(string)
            },
                        obj =>
            {
                return clusterMapper.Map(obj[0] as Cluster,
                                         obj[1] as string,
                                         obj[2] as Log,
                                         obj[3] as string);
            },
                        param,
                        splitOn: "ID,Nodes,LogID,AllNodes",
                        commandType: CommandType.StoredProcedure,
                        transaction: _unitOfWork.Transaction)).FirstOrDefault());
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <Cluster> > GetClusterByNode(string cNode)
        {
            var mapper = new ClusterMappers();

            var param = new DynamicParameters();

            param.Add("@Node", cNode);

            return(await SqlMapper.QueryAsync(
                       _unitOfWork.Connection,
                       "GetClusterByNode",
                       new[]
            {
                typeof(Cluster),
                typeof(string)
            },
                       obj =>
            {
                return mapper.Map(obj[0] as Cluster, obj[1] as string);
            },
                       param,
                       splitOn: "ID,Nodes",
                       commandType: CommandType.StoredProcedure,
                       transaction: _unitOfWork.Transaction));
        }
Exemplo n.º 3
0
        public async Task <IEnumerable <Cluster> > Select()
        {
            var mapper = new ClusterMappers();

            return((await SqlMapper.QueryAsync(
                        _unitOfWork.Connection,
                        "GetCluster",
                        new[]
            {
                typeof(Cluster),
                typeof(string),
                typeof(Log),
                typeof(string)
            },
                        obj =>
            {
                return mapper.Map(obj[0] as Cluster,
                                  obj[1] as string,
                                  obj[2] as Log,
                                  obj[3] as string);
            },
                        splitOn: "ID,Nodes,LogID,AllNodes",
                        commandType: CommandType.StoredProcedure,
                        transaction: _unitOfWork.Transaction)).Distinct());
        }
Exemplo n.º 4
0
        public async Task <IList <Premise> > Select()
        {
            var mapper = new ClusterMappers();

            return((await SqlMapper.QueryAsync(
                        _unitOfWork.Connection,
                        "GetPremise",
                        new[]
            {
                typeof(Premise),
                typeof(Customer)
            },
                        obj =>
            {
                var _premise = obj[0] as Premise;
                var _customer = obj[1] as Customer;
                _premise.Customer = _customer;
                return _premise;
            },
                        splitOn: "PremiseCustomerID",
                        commandType: CommandType.StoredProcedure,
                        transaction: _unitOfWork.Transaction)).Distinct().ToList());
        }