petapoco

Paged, Multi-Poco queries with Petapoco?

老子叫甜甜 提交于 2019-12-22 10:33:38
问题 PetaPoco is great and covers paged queries and Multi-Poco mapping, but I'm trying to figure out if there's a way to do them together? Edit: Here's the repository method I use to get MultiPoco data: // variables, used in multiple repo methods private readonly string _selectClause = String.Format(@"SELECT * FROM Clients OUTER APPLY (SELECT TOP 1* From Events WHERE Events.EndDateTime >= '{0}' AND Events.ClientId = Clients.Id ) Events WHERE Clients.TenantId=@0", DateTime.UtcNow); private readonly

How can integrate MVCMiniProfiler with PetaPoco without changing the sources

自作多情 提交于 2019-12-21 18:13:06
问题 I'm trying to get MVCMiniProfiler to work with PetaPoco I'm trying to set the connection in the creation of the PetaPoco DB, but run into problems (connectionClosed) public class DbHelper { static Database _CurrentDb = null; public static Database CurrentDb() { if (_CurrentDb == null) { string connstr = ConfigurationManager.ConnectionStrings["MainConnectionString"].ConnectionString; var conn = ProfiledDbConnection.Get(new SqlConnection(connstr)); _CurrentDb = new PetaPoco.Database(conn); }

petapoco query a Sql Server View

﹥>﹥吖頭↗ 提交于 2019-12-20 05:36:12
问题 I have started using the DAL2 with dotnetnuke 7. I have some complicated queries that I have created views for in the SQL server database that my instance uses. What is the best practice for accessing a simple select from these views. If I use the following then does this bypass the dbOwner and ObjectQualifier: Public Function GetProducts_Short_Active() As IEnumerable(Of Object) Using ctx As IDataContext = DataContext.Instance Return ctx.ExecuteQuery(Of Object)(CommandType.Text, "SELECT *

Workaround for PetaPoco / SQLite aggregate date bug

会有一股神秘感。 提交于 2019-12-12 15:43:05
问题 Here's complete code to create a SQLite database, fill some data into a table and then try to retrieve it. If there's an aggregate function around a datetime column, PetaPoco will throw an error. using System; using PetaPoco; class Program { static void Main(string[] args) { bool filenew = false; if (!System.IO.File.Exists(@"c:\temp\database.sq3")) filenew = true; System.Data.SQLite.SQLiteConnection sqltc = new System.Data.SQLite.SQLiteConnection("Data Source=" + @"c:\temp\database.sq3");

PetaPoco and output parameters from stored procedures?

不问归期 提交于 2019-12-12 13:04:39
问题 I'm trying to setup an output parameter using PetaPoco. I found someone using this sample online: var ctx = new CustomDBDatabase(); var total = new SqlParameter("Total", System.Data.SqlDbType.Int); total.Direction = System.Data.ParameterDirection.Output; var results = ctx.Query<DBEntity>("exec GetDBEntities @StartIndex, @MaxIndex, @TotalCount = @Total out", id, start, max, total); int totalCount = (int)total.Value; However, total.value returns null, even though when I run this statement

PetaPoco - Multiple result set support

冷暖自知 提交于 2019-12-12 09:37:58
问题 My work recently starting using PetaPoco and although fantastic I missed the feature from Dapper which allowed multiple result grids from a single query to be processed into pocos. As a result I wrote my own implementation for PetaPoco - shown below - but has anyone written their own and care to share it? I thought there might be others out there who have missed this feature. 回答1: Edit (2016-06-27): As of version 5.1.181 of PetaPoco (currently a beta at the time of writing) this feature is

mvc4 PetaPoco like query throwing exception

穿精又带淫゛_ 提交于 2019-12-12 03:15:23
问题 I am using petapoco. and making search query with like please let me know there is right query or not? var context = new PetaPoco.Database(Connection.connectionstring); SqlQuery = @"SELECT MenuId, MenuTitle, OrderNumber, CreatedDate, IsActive from Menu where MenuTitle LIKE @0, '%@MenuTitle%'"; List<MenuPOCO> objMenuPoco = context.Query<MenuPOCO> ( SqlQuery, new { @MenuTitle = MenuTitle }).ToList(); return objMenuPoco; please let me know the syntax is right? I am getting 0 records in each

PetaPoco parameter being treated as literal

假如想象 提交于 2019-12-12 01:59:24
问题 I'm executing a PetaPoco update statement like this: db.Execute("UPDATE Content SET Html = '@0', PlainText = '@1' WHERE ContentId = @2", newHtml, newText, c.EmailContentId); And the MySQL database is just sticking the parameter name into the field as a literal, i.e. the Html field now contains '@0' (without the quotes). I've run queries like this a thousand times and I don't see the mistake in this line. I've stepped through the PetaPoco code and it creates the MySqlCommand, which has a

error in running transformation:indexoutofrangeexception - petapeco

最后都变了- 提交于 2019-12-11 19:22:00
问题 as per suggestion for by @CreativeManix I started investigating petaPeco Retrieving large number of rows (more than 10 mil) in asp.net mvc application After adding exact system.data.oracleclient + putting web.config in the bin where mvc is getting compiled in .dll I got following error: Error 3 Running transformation: System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Array.InternalGetReference(Void* elemRef, Int32 rank, Int32* pIndices) at System.Array

In which project to add reference to PetaPoco?

六月ゝ 毕业季﹏ 提交于 2019-12-11 17:33:15
问题 I am new to Design Patterns and referring to a book by Scott Millet : Professional ASP.NET Design Patterns. In the chapter where it discusses "Separation of Concerns", I have added projects accordingly in the Solution Explorer: Though the book shows examples of Linq2SQL, I want to use PetaPoco Micro-ORM. I therefore installed PetaPoco via Nuget but I am not following whether to add PetaPoco to all the projects or only in the Model and WebUI Project. This is how NuGet asks for confirmation