コード例 #1
0
        public Contato Find(int id)
        {
            Database db      = new PetaPoco.Database("PRWDEV");
            var      contato = db.First <Contato>("Select * from contatosbandre where ID=@0", id);

            return(contato);
        }
コード例 #2
0
        /// <summary>
        /// Fetches the individual element
        /// </summary>
        /// <param name="key">The key of the element to fetch.</param>
        /// <returns>The fetched element, or null if not found</returns>
        public override SalesOrderHeader FetchIndividual(int key)
        {
            SalesOrderHeader toReturn = null;

            var dbFactory = new PetaPoco.Database(ConnectionStringToUse, "System.Data.SqlClient");

            dbFactory.OpenSharedConnection();
            toReturn = dbFactory.First <SalesOrderHeader>(CommandText + " where SalesOrderId=@0", key);
            dbFactory.CloseSharedConnection();
            return(toReturn);
        }
コード例 #3
0
        /// <summary>
        /// Fetches the individual element
        /// </summary>
        /// <param name="key">The key of the element to fetch.</param>
        /// <returns>The fetched element, or null if not found</returns>
        public override SalesOrderHeader FetchIndividual(int key)
        {
            SalesOrderHeader toReturn = null;
            var dbFactory             = new PetaPoco.Database(ConnectionStringToUse, "System.Data.SqlClient");

            dbFactory.OpenSharedConnection();
            dbFactory.EnableAutoSelect    = false;
            dbFactory.EnableNamedParams   = false;
            dbFactory.ForceDateTimesToUtc = false;
            toReturn = dbFactory.First <SalesOrderHeader>(CommandText + " where SalesOrderId=@0 ", key);
            dbFactory.CloseSharedConnection();
            return(toReturn);
        }