problem about dapper-Collection of common programming errors
svick
c# dapper reflection.emit unboxing dynamicmethod
Overview (forgive me for being so detailed, but I’d rather it be too much than too little): I’m attempting to edit the Dapper source for our solution in such a way that when any DateTime or Nullable is read from the database, its DateTime.Kind property is always set to DateTimeKind.Utc.In our system, all DateTimes coming from the front end are guaranteed to be in UTC time, and the database (Sql Server Azure) is storing them as DateTime type in UTC (We are not using DateTimeOffsets, we are just
loup
c# asp.net mapping dapper
I’ve only just started looking at Dapper.net and have just been experimenting with some different queries, one of which is producing weird results that i wouldn’t expect.I have 2 tables – Photos & PhotoCategories, of which are related on CategoryIDPhotos Table PhotoId (PK – int) CategoryId (FK – smallint) UserId (int)PhotoCategories Table CategoryId (PK – smallint) CategoryName (nvarchar(50))My 2 classes:public class Photo {public int PhotoId { get; set; }public short CategoryId { ge
cogumel0
c# dynamic dapper
I’m using Dapper to query from SQL and have a dynamic query as such:var returns = conn.Query(dynamicQuery);When I then cycle through the results, I would like to find out what the type of date I am handling is so I tried doing the following:foreach (var result in results) {MessageBox.Show(result.GetType().ToString()); }But it always fails on the MessageBox with the error Cannot perform runtime binding on a null reference.If I use this instead:var returns = conn.Query<object>(dynamicQuery);
Michael Perrenoud
c# dapper
I have an application in which I’m saving unknown structured data. So, let’s assume for a moment there is a table in the database named Foo and it looks like this:CREATE TABLE [dbo].[Foo] ([Id] INT NOT NULL PRIMARY KEY IDENTITY, [DataId] INT NOT NULL, [Bar] VARCHAR(50) NOT NULL, CONSTRAINT [FK_Foo_Data] FOREIGN KEY ([DataId]) REFERENCES [Data]([Id]) )And Foo is related to a table named Data which is going to store the provider who logged the data as well as the date and time it was logged, and l
Jay Walker
c# linq casting dapper dynamic-language-runtime
I’m using a method that has a return signatur of IEnumerable<dynamic>. At runtime for a particular call it is returning List<Dapper.SqlMapper.FastExpando>.var x0 = repo.Find(proc, param); //x0 runtime type is {List<Dapper.SqlMapper.FastExpando>}LINQPad.Extensions.Dump indicates the runtime type of x0 is: List<IDictionary<String, Object>> but I can’t seem to cast/convert to List<IDictionary<String, Object>>. Here is a screenshot of the Linqpad Dump:Ulti
Stephan Ryer
.net dapper
I use dapper in .NET 4.5 to ease querying my MS SQl database. The following works just fine:NO PROBLEMS:const string sql = @” SELECT g.Name, g.Slug, g.CreatedDate, COUNT(r.Id) recipientCount FROM Groups g LEFT JOIN GroupRecipients r ON r.GroupId = g.Id WHERE g.CustomerId = @CustomerId GROUP BY g.Id, g.Name, g.Slug, g.CreatedDate”;return _connection.Query(sql, new { CustomerId = customerId }).ToList();PROBLEM SELECTING ‘Id’ COLUMN – RAISES VerificationException:const string sql = @” SELECT g.Id,
SLoret
dapper
I have one query that does a count/group by where I don’t need a parameter (there is no where clause). What is the syntax to run a parameterless query with dapper?var _results = _conn.Query<strongType>(“Select Count(columnA) as aCount, ColumnB, ColumnC from mytable group by ColumnB, ColumnC”);does not work. I’ve tried it a few different ways but I still keep getting “ArgumentNullException was unhandled by user code”.Tried to figure it out myself, searched all over and I’m giving up. Thanks
user1428798
stored-procedures sql-server-2008-r2 mapping dapper sqlclient
I have a model this model: public class Member{#region public propertypublic int Id { get; set; }public string LastName { get; set; }public string FirstName { get; set; }public AccountState AccountState { get; set; }public GodFatherType GodFatherType { get; set; } }AccountState and GodFatherType Are both 2 eumerates:public enum AccountState {NotActivated = 0,Activated = 1,Desactived = 2,}public enum GodFatherType{Undefined=0,unknown = 1,Correct = 2,}In The database I have Id, LastName, FistName
dankorz
dapper
I know this is similar to Correct use of Multimapping in Dapper, but I think it’s slightly different. I have the following POCO structure:public class Customer {public int customerkey { get; set; }public string FirstName { get; set; }public string LastName { get; set; }public string EmailAddress { get; set; }public List<Invoice> Invoices { get; set; }public int statekey { get; set; }public State State { get; set; }public Customer(){this.Invoices = new List<Invoice>();} }public class
Chirdeep Tomar
sqlite3 mono dapper
I am using Mono, SQLite, Dapper & Dapper Extensions. I can read from the database but Insert is not working. I am using Mono Driver for sqlite. Error is not very informative, atleast to me. Any help will be much appreciated.Error: SQLite error near “.”: syntax error at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection cnn, System.String strSql, Mono.Data.Sqlite.SqliteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>
Web site is in building