1

I understand the basic principles of the micro orm systems like massive and dapper, however i'm struggling with understanding how it's possible to model a table with relationships.

ie:

Category 1---M Product

In my NHibernate, or Linq2SQL solutions, Category has a List property. There doesn't seem to be any examples of how this kind of relationship can be modelled. Particularly in linq where we might select on a category where there are products with specific names.

Paul
  • 9,409
  • 13
  • 64
  • 113
  • In the case of dapper, the project home page gives examples of multi-mapping (basically, using a wide single result rest) and multiple result sets to do this. Have you tried these? http://code.google.com/p/dapper-dot-net/ – Marc Gravell Feb 05 '12 at 19:16
  • also, be sure to read http://stackoverflow.com/tags/dapper/info ... if you notice any information is missing there, edit headings in and I will fill the blanks – Sam Saffron Feb 05 '12 at 22:25

2 Answers2

1

If you are thinking of shifting from any traditional ORM. I insist that you must watch this video posted by Rob Conery.

And the concern you showed in question about Domain Objects having another collection of domain objects as its property. It will not be an issue. Just a thing is this time you are putting values of that domain objected by your self.

Like here

Class Person
{
   public String FirstName{get;set;}
   public String LastName {get;set;}
   public IEnumarable<Address> {get;set;}
}

Class Address
{
   public String Address1 {get;set;}
   public String Address2 {get;set;}
}

Dynamic personData = new DynamicModel("connectionString","TableName","PrimaryKey");

var resultPerson = personData.All(where: "where condition") 
or 
var resultPerson = personData.Query("Join query will be here")

//Map resultPerson with PersonObject and return Person
//Still this will be faster than EF as per benchmark shown on Dapper page

I hope this will give your answer. If you need working code please let me know.

kunjee
  • 2,739
  • 1
  • 23
  • 38
0

You can use 'splitOn'. See for an example http://www.tritac.com/bp-24-dapper-net-by-example

Jeroen K
  • 10,258
  • 5
  • 41
  • 40