Questions tagged [multi-mapping]

25 questions
85
votes
9 answers

Multi-Mapper to create object hierarchy

I've been playing around with this for a bit, because it seems like it feels a lot like the documented posts/users example, but its slightly different and isn't working for me. Assuming the following simplified setup (a contact has multiple phone…
Jorin
  • 1,652
  • 1
  • 19
  • 25
22
votes
6 answers

How to achieve this Map> structure

I have data like below: Key value ----- ------ car toyota car bmw car honda fruit apple fruit banana computer acer computer asus computer ibm ... (Each row of above data is an object with…
Mellon
  • 37,586
  • 78
  • 186
  • 264
19
votes
1 answer

Can't get multi-mapping to work in Dapper

Playing around with Dapper, I'm quite pleased with the results so far - intriguing! But now, my next scenario would be to read data from two tables - a Student and an Address table. Student table has a primary key of StudentID (INT IDENTITY),…
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
5
votes
1 answer

Some value return null on Dapper Multi Mapping

I'm having a problem using Dapper. I have a list of the Rubrica class that contains the field valore. When I run a query with a JOIN and identify the agenda type, the valore field remains set to null My two classes Rubrica and TipoAgenda public…
Lorenzo Belfanti
  • 1,205
  • 3
  • 25
  • 51
5
votes
2 answers

Mapping Dapper Query to a Collection of Objects (which itself has a couple of Collections)

I want to execute a single Query (or Stored Proc with multiple resultsets). I know how to do Multi-mapping using Dapper, but I can't sort how to map the two collections onto the same parent. Basically, given this Object definition... class…
Jay Stevens
  • 5,863
  • 9
  • 44
  • 67
4
votes
1 answer

Dapper.NET multi mapping TSecond Deserializer is null

I'm trying to perform a very standard multi mapping query using Dapper, and I'm getting the following error. I also get another error occasionally when this seems to work, but I'm unable to reproduce it at the moment. I'll append it to this post…
George
  • 1,964
  • 2
  • 19
  • 25
4
votes
2 answers

Dapper Syntax for Nested Multi Mapping

class Person { Address Addr { get; set; } int Age { get; set; } } class Address { string StreetName { get; set; } County Cnty { get; set; } } class County { string…
Rakshit Bakshi
  • 281
  • 3
  • 11
4
votes
1 answer

c# Dapper, SplitOn: multiple same parameter issue Multi-mapping one-to-many

I have an issue were Dapper Query splits on the parent object and not the child object. The result gives back one parent row per child, giving many duplicate parents with only 1 child in them. One possible issue im exploring is if the primary key…
3
votes
1 answer

Using Dapper to populate objects from a T-SQL View

I'm trying out using Dapper for my data access (in ASP.NET MVC3 FWIW). I have a a T-SQL view (in SQL Server) which is something like this: SELECT s.*, c.CompanyId AS BreakPoint c.Name AS CompanyName FROM tblStaff AS s INNER JOIN tblCompanies AS c…
Sam Huggill
  • 3,106
  • 3
  • 29
  • 34
2
votes
2 answers

finding all the values with given key for multimap

I am searching for all pairs for a particular key in a multimap using the code below. int main() { multimap mp; mp.insert({1,2}); mp.insert({11,22}); mp.insert({12,42}); mp.insert({1,2}); mp.insert({1,2}); for…
2
votes
1 answer

Dapper Multi Mapping Not Splitting on Named Parameters

New to Dapper here! Having an issue with multi-mapping. This is my query: var sql = @"select distinct a.*, c.Id as 'GenreId', c.Active as 'GenreActive', c.Link as 'GenreLink', c.Name as 'GenreName', c.DateCreated as…
jallen
  • 602
  • 12
  • 32
2
votes
2 answers

Dapper Multipmapping collection within collections

In Dapper, what's the best way to map and object that contains a list and each of those list items have their own lists? class Object1 { int Object1Id; List object2s; } class Object2 { int Object2Id; List
user3093582
2
votes
2 answers

Accessing elements in a mulimap

I am trying to create a program that takes in data from a .txt or similar file and asks the user for a word to search for. The output should show the keyword in context with the 2 words that were originally in front of it, as well as behind it. (EX:…
littlenv
  • 21
  • 1
2
votes
1 answer

Dapper > Multi mapping fails to map bit to boolean properly

I have the following code: string sql = "SELECT * FROM orders o " + "INNER JOIN users u ON o.user_id = u.id " + "WHERE o.ticker = @ticker AND o.user_id = @user_id"; var _orders =…
Kevin
  • 63
  • 6
1
vote
1 answer

How to iterate a C++ map of maps

I have a map of map std::map< int, std::map > myMap; std::map< int, std::map >::iterator itr; Iterating it with: itr = myMap.find(nodeI); if (itr == myMap.end()) { exit(1) ; } results in the…
dtustudy68
  • 325
  • 1
  • 4
  • 13
1
2