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); }
/// <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); }
/// <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); }